Another Netscape Javascript question 
Author Message
 Another Netscape Javascript question

Can someone please explain why this doesn't work in Netscape?

<script>
        function ChangeFrame() {

parent.frames("Frame1").frames("Frame2").location.href="x.asp";
        }
</script>

This code returns this error: parent.frames("Frame1") doesn't have
properties . I'm not sure if this is the right message but this is
it's meaning. I've tried to replace the parenthesis with square
brackets yet it doesn't work. I get the same error message. I haven't
even tried to replace the name of the frame with it's index (and i
WON'T do it because it's stupid and bad programming!). I have even
downloaded Netscape's Javascript Reference Guide but it's no help.
What i have done is to put a curse on the Netscape company! =) I can
stand it no more! When will they understand that their browser is
really bad! I don't care if it follows the W3 or whatever conventions
strictly. IT SUCKS! That it requires correct HTML formatting is good,
that it processes Javascript it's own way is stupid! They should look
up to MS and try to build a better browser than MS's not build a
browser that is this crappy and every programmer i know (and those i
don't) say it's bad! Even if it follows those W3 conventions. I don't
think IE doesn't follow the conventions. The only difference between
IE and NN is that IE's team spend some time doing some good
programming so that their browser is a bit more flexible and logical!!
Bah! Enough flamming! I'm sorry but i had to say that. Hope it's well
translated :) Can someone help me with that piece of code please?

Celso Pinto
StarMdia, Lda.



Sat, 06 Jul 2002 03:00:00 GMT  
 Another Netscape Javascript question


Quote:
> Can someone please explain why this doesn't work in Netscape?

Because the programmer wrote it against the specifications.

Quote:
> <script>
> function ChangeFrame() {
> parent.frames("Frame1").frames("Frame2").location.href="x.asp";

Now you said below that you tried [] so you most know that round brackets
don't work. (there's no such thing as a collection in netscape.)

If you'd've provided enough code we could say why

parent.frames["Frame1"].frames["Frame2"].location.href="x.asp";

didn't work, Who knows why it is, without knowing the frameset
definitions, it's right otherwise.

Quote:
> I have even
> downloaded Netscape's Javascript Reference Guide but it's no help.

It might've been a good idea to look at that at the same time...

Quote:
> What i have done is to put a curse on the Netscape company! =) I can
> stand it no more! When will they understand that their browser is
> really bad! I don't care if it follows the W3 or whatever conventions
> strictly. IT SUCKS! That it requires correct HTML formatting is good,
> that it processes Javascript it's own way is stupid!

It can process Javascript anyway it wants, they do own all the rights to
the language (except the name) You'll also find JScript and JavaScript to
be staggeringly similar in almost all respects, if you understand the
difference between language and host.

Quote:
> Bah! Enough flamming! I'm sorry but i had to say that.

No you didn't, just ask the question, the moaning just demonstrates your
own deficiencies, there are a large number of developers who don't have
the same problems, which suggest the browsers aren't at fault, just don't
bother with the useless flames.

Jim.



Sat, 06 Jul 2002 03:00:00 GMT  
 Another Netscape Javascript question
Hi Celso

I have made up three pages to reflect what I believe is your scenario. Of
course, the ChangeFrame function didn't work with the parenthesis, but it
did very nice with the square brackets in my Communicator 4.08.

You may be missing something somewhere. How are your framesets set up?
These are the three pages I used in this test. Write any valid URL in the
text box and click the ChangeFrame button to see the left frame change its
location.

**** This is frameset.htm, the main page ****
<HTML>
<head>
</head>
<frameset rows="50%,50%" framespacing="0" border="1" frameborder="0">
  <frame name="Frame0" scrolling="auto" noresize src="ChangeFrames.htm">
  <frame name="Frame1" scrolling="auto" noresize src="frames.htm">
</frameset>
</HTML>

**** This is ChangeFrames.htm, the one that has the ChangeFrame function
****
<HTML>
<head>
<script>
function ChangeFrame(newURL) {
   parent.frames['Frame1'].frames['Frame2'].location.href = newURL;
   return true;

Quote:
}

</script>
</head>
<body>
<form>
  <input type="text" name="txtURL">
  <input type="button" value="ChangeFrame"
onclick="ChangeFrame(document.forms[0].txtURL.value);">
</form>
</body>
</HTML>

**** This is frames.htm, the one that sets up the other frameset ****
<HTML>
<head>
</head>
<frameset cols="50%,50%" framespacing="0" border="1" frameborder="0">
  <frame name="Frame2" scrolling="auto" noresize src="about:">
  <frame name="Frame3" scrolling="auto" noresize src="about:">
</frameset>
</HTML>

Hope this helps.
Klaus

Quote:

> Can someone please explain why this doesn't work in Netscape?

> <script>
>         function ChangeFrame() {

> parent.frames("Frame1").frames("Frame2").location.href="x.asp";
>         }
> </script>

> This code returns this error: parent.frames("Frame1") doesn't have
> properties . I'm not sure if this is the right message but this is
> it's meaning. I've tried to replace the parenthesis with square
> brackets yet it doesn't work. I get the same error message. I haven't
> even tried to replace the name of the frame with it's index (and i
> WON'T do it because it's stupid and bad programming!). I have even
> downloaded Netscape's Javascript Reference Guide but it's no help.
> What i have done is to put a curse on the Netscape company! =) I can
> stand it no more! When will they understand that their browser is
> really bad! I don't care if it follows the W3 or whatever conventions
> strictly. IT SUCKS! That it requires correct HTML formatting is good,
> that it processes Javascript it's own way is stupid! They should look
> up to MS and try to build a better browser than MS's not build a
> browser that is this crappy and every programmer i know (and those i
> don't) say it's bad! Even if it follows those W3 conventions. I don't
> think IE doesn't follow the conventions. The only difference between
> IE and NN is that IE's team spend some time doing some good
> programming so that their browser is a bit more flexible and logical!!
> Bah! Enough flamming! I'm sorry but i had to say that. Hope it's well
> translated :) Can someone help me with that piece of code please?

> Celso Pinto
> StarMdia, Lda.



Sat, 06 Jul 2002 03:00:00 GMT  
 Another Netscape Javascript question
Hi! Here is the code:

*** Main Frameset ***
<HTML>
<HEAD>
</HEAD>
<FRAMESET id=frmMain name=frmMain>
        <FRAMESET id=frmMenu name=frmMenu>
                <FRAME id=frmMainMenu name=frmMainMenu src="menu.htm">
                <FRAME id=frmSubMenu name=frmSubMenu
src="submenu.htm">

        </FRAMESET>

        <FRAME id=frmMainPage name=frmMainPage src="MainPage.htm">
</FRAMESET>
</HTML>

When i click an item on the Menu page it loads another page to the
frmMainPage frame (this works very well because i use the target
property in the hyperlink). This page (lets call it NewPage.htm) has
the following code:

<HTML>
<HEAD>
<script>
        function ShowSubMenu() {

parent.frames("frmMenu").frames("frmSubMenu").location.href="submenu2.htm";
        }
</script>
</HEAD>
<BODY onload="ShowSubMenu();">
</BODY>
</HTML>

I put this code as it is for IE. For NN i changed the parenthesis for
square brackets and it didn't work. I get the same error message i
sent before: parent.frames("frmMenu")  doesn't have properties. I did
read the Javascript Reference Guide i downloaded from Netscape and i
saw i had to replace the parenthesis with square brackets and that's
what i did. Unfortunatelly i don't have much time to spend looking
around for this answer and to learn to develop javascript NN oriented
(IE is much more intuitive) because, like all developers, i have a
rope around my neck that gets tighter and tigher every day as the
delivery date for the site gets closer. That's why i sent this (and
other) message. I know this doesn't belong in the reply for this
message but i guess Jim Ley will read this message too :)

Thank you for your help.

On Tue, 18 Jan 2000 14:54:07 -0200, "Klaus S. Magnelli"

Quote:

>You may be missing something somewhere. How are your framesets set up?
>These are the three pages I used in this test. Write any valid URL in the
>text box and click the ChangeFrame button to see the left frame change its
>location.

Celso Pinto
StarMdia, Lda.


Sun, 07 Jul 2002 03:00:00 GMT  
 Another Netscape Javascript question


Quote:
> Hi! Here is the code:

> *** Main Frameset ***
> <HTML>
> <HEAD>
> </HEAD>
> <FRAMESET id=frmMain name=frmMain>
> <FRAMESET id=frmMenu name=frmMenu>
> <FRAME id=frmMainMenu name=frmMainMenu src="menu.htm">
> <FRAME id=frmSubMenu name=frmSubMenu
> src="submenu.htm">

> </FRAMESET>

> <FRAME id=frmMainPage name=frmMainPage src="MainPage.htm">
> </FRAMESET>
> </HTML>
> When i click an item on the Menu page it loads another page to the
> frmMainPage frame (this works very well because i use the target
> property in the hyperlink). This page (lets call it NewPage.htm) has
> the following code:

> <HTML>
> <HEAD>
> <script>
> function ShowSubMenu() {

parent.frames("frmMenu").frames("frmSubMenu").location.href="submenu2.htm"
;

Quote:
> }
> </script>
> </HEAD>
> <BODY onload="ShowSubMenu();">
> </BODY>
> </HTML>

I was amazed that that code even worked in IE - and then after testing I
found it didn't work, I hope it was because of a mistake in pasting some
code you were trying out, rather than the real code -  it crashes out with
a GPF in my IE5.0.- after giving it rows="100,*" in each frameset so it
would be actually rendered in the first place. - Framesets are irrelevant,
you can have 100 framesets in a file, you'll still only have one level of
frames array.

Quote:
> Unfortunatelly i don't have much time to spend looking
> around for this answer and to learn to develop javascript NN oriented
> (IE is much more intuitive) because, like all developers, i have a
> rope around my neck that gets tighter and tigher every day as the
> delivery date for the site gets closer. That's why i sent this (and
> other) message. I know this doesn't belong in the reply for this
> message but i guess Jim Ley will read this message too :)

When you have a deadline it is much, much quicker to get help from a faq,
or an example site, there's loads of resources out there that give example
s which would show your mistakes. www.squeaky.demon.co.uk/jn/meta-faq.htm
is a place to start if you don't know where else to look.

As to learning your job, do you think it would be right for a doctor to
say, I don't have time to go around learning how to operate on a heart,
someone just tell me... ? no if your a professional you've got to spend
time learning your trade.

Anyway in answer to your question.

it's simply

document.frames['subMenuFrame'].location.href

frames[].frames[] is only needed where you have documents with frames
inside frames, not just framesets within framesets.

Jim.



Sun, 07 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Netscape compatibility problem in JavaScript (free navigation bar)

2. Need Microsoft JScript equivalent to Netscape JavaScript statement

3. Javascript + Netscape Problem

4. Javascript with Netscape on Unix platforms.

5. translation from vbscript into javascript for compatibiliti with Netscape 4.7

6. Error in Netscape Calling Java from JavaScript

7. javascript vs. netscape/frames

8. Netscape behaving badly...javascript issue...

9. list of diff in JavaScript IE Netscape

10. Testing JScript and JavaScripts on old IE / Netscape

11. Netscape forms and javascript

12. javascript engine execution speed - Netscape v IE (30k code in htm file)

 

 
Powered by phpBB® Forum Software