Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writeln in NS 6 causes problem

Status
Not open for further replies.

ChrisQuick

Programmer
Oct 4, 1999
144
US
I am opening a window and using writeln to write some frame tags. Then I reference the first frame and try to write to it. Problem: This works fine in IE 5.0, and 5.5. It also works in netscape 4.76 BUT blows up in NS 6.1.

Here is the error: Win1.document has no properties line 172.

Code:
Code:
						var NewFramesWin = openPageTop(appDir + "text.htm","QueryWindow","scrollbars=yes,resizable=yes,dependant=yes")
						NewFramesWin.document.writeln('<html><head><title>' + titleList[7] + '</title></head>');
						NewFramesWin.document.writeln('<FRAMESET COLS=&quot;130,*&quot; FRAMEBORDER=&quot;0&quot; FRAMESPACING=&quot;0&quot; BORDER=0>');
						NewFramesWin.document.writeln('		<FRAME NAME=&quot;NavFrame&quot; SRC=&quot;' + appDir +'blank.htm&quot; MARGINWIDTH=&quot;5&quot; MARGINHEIGHT=&quot;0&quot; SCROLLING=&quot;no&quot; FRAMEBORDER=&quot;0&quot; NORESIZE>');
						NewFramesWin.document.writeln('		<FRAME NAME=&quot;ResultsFrame&quot; SRC=&quot;' + appDir +'blank.htm&quot; MARGINWIDTH=&quot;5&quot; MARGINHEIGHT=&quot;0&quot; SCROLLING=&quot;yes&quot; FRAMEBORDER=&quot;0&quot; NORESIZE>');
						NewFramesWin.document.writeln('</FRAMESET>');
						NewFramesWin.document.writeln('</html>');
						NewFramesWin.document.close();
						var Win1 = NewFramesWin.frames[0];
						Win1.document.open(); <--- line 172


Besides just saying &quot;well netscape stinks&quot; or &quot;netscape sux&quot;, does anyone have any idea how to work around this? cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
Is anyone else having problems with javascript and NS 6? cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
Still hoping to find an anwswer to this.. Are there any other sites or forums to search for javascript bugs? cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
I am still having this problem with netscape 6.1.. cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
The writeln is used in both netscape and IE.. The problem is that NS 6.1 is not finding the frame that it just created.. cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
I think your problem may be that
Code:
NewFramesWin
already has a URL. Try this:
Code:
NewFramesWin=open(&quot;javascript:' ';&quot;,&quot;&quot;,&quot;scrollbars=yes,resizable=yes,dependant=yes&quot;);
The reason for the page's URL to be
Code:
javascript:' ';
comes from some coding that made me find out that pre-Gecko Netscape doesn't recognize a page's document object if it has no URL at all, and Opera doesn't recognize it if it doesn't have any source code. SO, the space within the quotes is to provide some source code to the page for Opera to accept, and calling
Code:
javascript:
is for both Opera and NS 3,4. Keep it in.

Having JavaScript generate the source for the page (or frame) right when the page is opened allows JavaScript to access it. Using a real URL prevents JavaScript from writing to it.

See the project that made me find that out:
It's an HTML editor... For plain HTML, it's pretty useless. But in the JavaScript realm, it's a HUGE time-saver.

Tell it to yourself and tell it to your children... Don't steal! (just in case you want to take credit for HTMaker ;-))
 
Oh yes, I forgot to mention: It's not
Code:
writeln()
that's causing NS 6 not to work. Keep using it if you want.
 
whoa, ur just everywhere tonite UNIMENT. :) The pen is mightier than the sword.
 
Oh wow... Dookie, you made me look at my clock and it said 6:21 AM!! (I forgot that I had messed it up yesterday) Did I stay up all night?? heh
 
Yes, it's PM just for your information; my clock was messed up ;-)
 
Thanks, UNIMINT, but I still get the same error in both NS 6.1 and 6.2. cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
I don't know... the code seems to work for me.
Here's the code I tested (I didn't get any errors):
Code:
NewFramesWin=open(&quot;javascript:' ';&quot;, &quot;&quot;, &quot;scrollbars=yes,resizable=yes,dependant=yes&quot;);
NewFramesWin.document.open();
NewFramesWin.document.writeln('Hey there');
NewFramesWin.document.close();
It opens a new window that has the text &quot;Hey there&quot; in it.
I tested it to work in NS 4.79, Mozilla 0.98, and IE 6.0 . In case you didn't know, Netscape 6 is built on Mozilla's engine.
 
Well, that works for me too.. but have you tried opening a window and writing frame tags, then writing to one of the frames?? cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
Ok... I tried this code and it worked just fine:
Code:
NewFramesWin=open(&quot;javascript:' ';&quot;, &quot;&quot;, &quot;scrollbars=yes,resizable=yes,dependant=yes&quot;);
NewFramesWin.document.open();
NewFramesWin.document.writeln('<html><frameset cols=&quot;200,*&quot;><frame src=&quot;javascript:\'<html><body>Frame One<\/body><\/html>\';&quot;><frame src=&quot;javascript: \'<html><body>Frame Two<\/body><\/html>\';&quot;><\/frameset><\/html>');
NewFramesWin.document.close();

// Access one of its frames:
NewFramesWin.frames[0].document.open();
NewFramesWin.frames[0].document.writeln(&quot;I've been re-written.&quot;);
NewFramesWin.frames[0].document.close();

It worked exactly the way I hoped and exactly the way I expected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top