[PLUG] JavaScript Communication Between Frames
Richard C. Steffens
rsteff.l at comcast.net
Wed Jan 19 18:35:01 UTC 2005
Are then any JavaScript guru's out there?
I understand from a book I'm reading (Danny Goodman's JavaScript Handbook)
that it is possible to put JavaScript code in the head of a frameset page
that can be called from the other pages loaded by the frameset. I've seen an
example work, but I don't see what I'm missing to get my example to work.
Here's my example:
(file name: twoFrame.html)
<html>
<head>
<title>Two Frame Test</title>
<script type="text/javascript" language="javascript">
<!-- Start Script
// function to process the click of the button
function btnClick() {
document.form1.text1.value = "You clicked this button."
document.form2.text2.value = "You clicked the button on the other form."
}
// End Script -->
</script>
</head>
<frameset frameborder=1 rows="25%,*">
<frame name="frameOne" src="frameOne.html">
<frame name="frameTwo" src="frameTwo.html">
</frameset>
</html>
(file name: frameOne.html)
<html>
<body>
This is Frame One<br />
<form name = "form1" action = "action">
<input type = "button" value = "Push this button"
onclick="parent.btnClick()" />
<br />
<br />
<input type="text" name="text1" size="50" />
</form>
</body>
</html>
(file name: frameTwo.html)
<html>
<body>
This is Frame Two<br />
<form name = "form2" action = "action">
<input type="text" name="text2" size="50" />
</form>
</body>
</html>
I assume there's something important I'm missing. Any idea what? And, any
recommendation on where to find JavaScript examples that do this sort of
thing?
Thanks in advance.
--
Regards,
Dick Steffens
http://home.comcast.net/~rsteff/
More information about the PLUG
mailing list