Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chrome DOM from child in iframe

Status
Not open for further replies.

peterpann

Programmer
Jun 19, 2007
63
GB

In Chrome what is the syntax to call parent DOM properties from a child in an iframe ?

parent.document.getElementById("divparent").scrollWidth etc works in IE8, FX, Opera, Safari but not in Chrome.
 
code at

<html>
<head>
<title>testparent.htm</title>
</head>
<body>
<span id="storescreenheight" style="display:none;"></span>
<br />
<iframe src="testchild.htm" height="400px"></iframe>
<script type="text/javascript">
var sh = 222;
document.getElementById("storescreenheight").innerHTML = sh;
</script>
</body>
</html>

<html>
<head>
<title>testchild.htm</title>
</head>
<body><a href="javascript:alert('1 ' + parent.document.getElementById('storescreenheight').innerHTML)">
parent.document.getElementById</a>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top