By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

location.href doesn't seem to work

P: n/a
Folks,
I wrote a simple javascript script, but it doesn't work.
First I have a web page that uses frames:
=====================
<html>
<frameset rows="10%,90%">
<frame src="frame1.htm" name="frameName1">
<frame src="frame2.htm" name="frameName2">
</frameset>
</html>
=====================
Then within the page 'frame1', I try to have a function that fills page
'frame2'. The function is:
<script LANGUAGE="JAVASCRIPT">
function ShowSeminars()
{
/*parent.framename2.location.href = "http://www.amazon.com";*/
parent.framename2.location.href = "frame3.htm";

}
</script>
I have a button that calls the function.
But the function does not work. First I thought the reason was that it
links to outside websites, but the code doesn't even work when it links
to 'frame3.htm' (a local page).

I tried 'firefox's javascript console to tell me whats wrong, and it
says something like 'parent.framename2' has no properties.
Thanks,
Marvin

Oct 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

COHENMARVIN wrote:
Folks,
I wrote a simple javascript script, but it doesn't work.
First I have a web page that uses frames:
=====================
<html>
<frameset rows="10%,90%">
<frame src="frame1.htm" name="frameName1">
<frame src="frame2.htm" name="frameName2">
</frameset>
</html>
=====================
Then within the page 'frame1', I try to have a function that fills page
'frame2'. The function is:
<script LANGUAGE="JAVASCRIPT">
function ShowSeminars()
{
/*parent.framename2.location.href = "http://www.amazon.com";*/
parent.framename2.location.href = "frame3.htm";

}
</script>
I have a button that calls the function.
But the function does not work.


Javascript is case-sensitive.
FrameName2 != framename2

Try
parent.frameName2.location.href = "frame3.htm";

Oct 11 '05 #2

P: n/a
COHENMARVIN a écrit :
Folks,
I wrote a simple javascript script, but it doesn't work.
First I have a web page that uses frames:
=====================
You should add this doctype declaration:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

<html>
<head><title>Showing seminars</title>
<frameset rows="10%,90%">
<frame src="frame1.htm" name="frameName1">
<frame src="frame2.htm" name="frameName2">
</frameset>
</html>
=====================
Then within the page 'frame1', I try to have a function that fills page
'frame2'. The function is:
<script LANGUAGE="JAVASCRIPT">
<script type="text/javascript">

Language is deprecated while type is both backward and forward-compatible.
function ShowSeminars()
{
/*parent.framename2.location.href = "http://www.amazon.com";*/
parent.framename2.location.href = "frame3.htm";
parent.frames["frameName2"].location.href = "frame3.htm";

}
</script>
</head>
I have a button that calls the function.
But the function does not work. First I thought the reason was that it
links to outside websites, but the code doesn't even work when it links
to 'frame3.htm' (a local page).

I tried 'firefox's javascript console to tell me whats wrong, and it
says something like 'parent.framename2' has no properties.


That means firefox does not "see" "parent.framename2" as edited. The
name is frameName2, not framename2.

Gérard
--
remove blah to email me
Oct 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.