Forum Moderators: open
code for five short pages to illustrate the problem
index.htm page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
</head>
<frameset cols="10%,30%,60%">
<frame src="hidden.htm" name="hidden">
<frame src="menu.htm" name="menu">
<frame src="page1.htm" name="content">
</frameset>
</html>
page1.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
</head>
<body>
this is page 1 with nothing else but this text
</body>
</html>
page2.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
<script language="JavaScript" type="text/javascript">
<!--
function saveIt(){
parent.hidden.storedData=myform.mydata.value
}
function loadIt(){
myform.mydata.value=parent.hidden.storedData
}
//-->
</script>
</head>
<body onload="loadIt()">
Page 2
<form name="myform">
<input type="text" name="mydata" size="20" onblur="saveIt()">type anything
</form>
</body>
</html>
hidden.htm page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
<script language="JavaScript" type="text/javascript">
<!--
var storedData=""
//-->
</script>
</head>
<body>
this is the left most frame
</body>
</html>
menu.htm page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
</head>
<body>
Menu page
<br>
<a href="page1.htm" target="content">page 1</a>
<br>
<a href="page2.htm" target="content">page 2</a>
</body>
</html>
thanks in anticipation!
Let's pick the JavaScript apart, shall we?
function saveIt(){
parent.hidden.storedData=myform.mydata.value
}
function loadIt(){
myform.mydata.value=parent.hidden.storedData
}
parent.hidden.storedData parent frameset, in which we're looking for the hidden frame, in which we expect to find the... wait! There are no elements in the hidden frame! Instead, the storedData variable resides in the document loaded in the hidden frame. Thus, that piece of code should read: parent.hidden.[b]document[/b].storedData Now, what about
myform.mydata.value? Well, technically that should read: [b]document[/b].myform.mydata.value, just to avoid problems in some browsers.