...

View Full Version : iFrame target Parent Javascript



Steven_Smith
06-03-2004, 05:00 PM
Hello,

I am trying to get an iframe to target its parents javascript.

Parent


<html>
<head>
<script>
function xyz(){
alert('Way to go')
}
</script>
</head>
<body>
<iframe name="myframe" src="myframe.html" height="100" width="100"><iframe>
</body>
</html>


iframe


<html>
<head>

</head>
<body>
<a href="javascript: window.parent.xyz();">Click me</a>
</body>
</html>


But this doesn't work. Any ideas?
Thanks
Steve

Willy Duitt
06-04-2004, 05:49 AM
Try:

<a href="javascript&#58;opener.xyz();">Click me</a>

glenngv
06-04-2004, 06:18 AM
Try:

<a href="javascript:opener.xyz();">Click me</a>
That will only work if the parent page opens the page in the iframe.

Steven_Smith, your code should work even though you have an unclosed iframe there.

<iframe name="myframe" src="myframe.html" height="100" width="100"><iframe>

Did you encounter any error message?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum