Jump to content

Recommended Posts

Ok! It's for Google Chrome this issue.  Safari, IE, FF, Opera work fine.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>J</title>

<script type="text/javascript">

function changeStyle()

{

var x=document.getElementById("myframe");

var y=(x.contentWindow || x.contentDocument);

if (y.document)

    y=y.document;

y.body.style.backgroundColor="#0000ff";

}

</script>

</head>

<body onload="changeStyle()">

 

<iframe id="myframe" src="js1.htm">

<p>Your browser does not support iframes.</p>

</iframe>

<br /><br />

 

<input type="button" onclick="changeStyle()" value="Change background color" />

 

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/248656-iframe-content/#findComment-1277090
Share on other sites

I have both files in my PC.  The console outputs Unsafe JavaScript attempt to access frame with URL file:///C:/Documents%20and%20Settings/Administrador/Escritorio/js1.htm from frame with URL file:///C:/Documents%20and%20Settings/Administrador/Escritorio/js2.htm. Domains, protocols and ports must match.

 

Any idea?

Link to comment
https://forums.phpfreaks.com/topic/248656-iframe-content/#findComment-1277103
Share on other sites

One more question about this issue.  Does contentDocument() javascript method work on subdomains. 

I have this site http://www.binal.ac.pa/harias/series.htm and I load an iframe in each of this categories listed.  What I want to do with JS is to send a char via simulating a click and sending the char to the DB application.

 

Thanks for your comments!

 

And yes I'm using Chrome but now with Wamp localhost.

 

Link to comment
https://forums.phpfreaks.com/topic/248656-iframe-content/#findComment-1277804
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.