Forum Moderators: open

Message Too Old, No Replies

Netscape vs IE - hidden frames problem

netscape won't allow data transfer using hidden frames, but it's OK in IE

         

sparky77

1:40 am on Dec 16, 2003 (gmt 0)

10+ Year Member



I have been trying to get data stored in a hidden frame, to reload when a page is re-visited within a framed site.
Works fine in IE, but not in NN.
Can anyone see what the problem is?
(apologies if it's obvious - I'm a beginner!)

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!

DrDoc

4:03 am on Dec 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

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

What does this point to? The
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.

sparky77

2:50 pm on Dec 31, 2003 (gmt 0)

10+ Year Member



Many thanks Doc!
that was exactly the problem.

PCInk

3:25 pm on Dec 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In Netscape, typing Javascript: into the address bar will show all the errors. NN7 also shows the line and usually the reason why.

sparky77

3:29 pm on Jan 1, 2004 (gmt 0)

10+ Year Member



typing Javascript: into the address bar

I tried this in NN7 but it just gave search results for javascript. Anything I should do to get it working?