Hoping someone here knows enough about Javascript to help out. I'm having problems with a Javascript function being called from an iframe.
Here's the parent page:
And here's TestPage which is loaded in the iframe:
I can get the alert to pop up saying "GOATS" no problem, but the text field in the parent doesn't change. If I have a button on the parent it works fine, so I'm guessing I need to change the "document." part of that line, but "top." and "parent." don't work either. Does anyone know what I'm doing wrong?
Here's the parent page:
Code:
<html>
<head>
<script language="JavaScript">
<!--
function test(sendvalue)
{
document.out0.value = sendvalue;
alert(sendvalue);
}
//-->
</script>
</head>
<body>
<p><input type=text name=out0></p>
<p><iframe style="width:100%; height:100%" src="TestPage.htm">
</iframe></p>
</body>
</html>
And here's TestPage which is loaded in the iframe:
Code:
<html>
<head>
</head>
<body>
<form name=a>
<input type=button value="Test" onClick="top.test('GOATS');">
</form>
</body>
</html>
I can get the alert to pop up saying "GOATS" no problem, but the text field in the parent doesn't change. If I have a button on the parent it works fine, so I'm guessing I need to change the "document." part of that line, but "top." and "parent." don't work either. Does anyone know what I'm doing wrong?
Last edited: