473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

location.href doesn't seem to work

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
2 2073

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ravi | last post by:
I have a webpage(with a text field and a button) which prompts for a local file and attempts to load the file in the window if the user clicks on the button. The javascript code onClick event uses...
4
by: Max of Mad | last post by:
Hi all, I wrote this a while back, but I was unable to get it to work for mozilla. Looked all over the place, but could not find anything on why. Basically, this has a dropdown of some search...
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
1
by: JF | last post by:
Hi, I need to change the location of the parent window and after that scroll a little bit (because of "position:fixed" css buttons, which obscure the title). I have...
13
by: Jerry Manner | last post by:
Hi I have a problem using the location.href("ProductL.htm") javascript code. Using this code on my system ( W98 SE, IE 6.0) is working correctly. But if a user has W2000 IE 5.0 it doesn't work....
2
by: JHB | last post by:
Hi, How can I do a location.replace when I use a form, like when I use a href? This works. <a href="Ny HTML-side20.htm"; method="post" id="frm" name="BrugerHovedSide"...
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
1
by: Tazy | last post by:
does anyone know the work around using location.href with firefox. it doesn't work with firefox but fine with ie. please help, doug
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.