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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Netscape and document.write() 1

Status
Not open for further replies.

CHB80

Programmer
Jun 21, 2000
2
0
0
DE
Hi,<br><br>i tried for hours now, but nothing helped.<br>I use the following JS-Code to create a new document in a frame, that should run some JS-functions (of course without the linenumbers):<br><br>(01) open();<br>(02) writeln(&quot;&lt;html&gt;&quot;);<br>(03) writeln(&quot;&lt;head&gt;&quot;);<br>(04) writeln(&quot;&lt;title&gt;Verlauf&lt;/title&gt;&quot;); <br>(05) writeln(&quot;&lt;link rel=stylesheet type=\&quot;text/css\&quot; href=\&quot;verlauf.css\&quot;&gt;&quot;);<br>(06) write(&quot;&lt;script language=\&quot;JavaScript\&quot; src=\&quot;verlauf.js\&quot; type=\&quot;text/javascript\&quot;&gt;&quot;);<br>(07) write(&quot;&lt;/script&gt;&quot;);<br>(08) writeln(&quot;&lt;/head&gt;&quot;);<br>(09) writeln(&quot;&lt;body&gt;&quot;); <br>[...] Here are the Links calling a JS-function<br>(10) writeln(&quot;&lt;/body&gt;&quot;);<br>(11) writeln(&quot;&lt;/html&gt;&quot;);<br>(12) close();<br><br>The functions called between 09 and 10, are in the file &quot;verlauf.js&quot;. <br>With IE everything's OK. But Netscape (both 4.x and 6b) seems to filter the &quot;write();&quot;-calls and ignores the lines 06 and 07, what causes the function-calls between 09 and 10 fail, 'cause the original-function could not be found.<br>What can i do to make Netscape allow lines 09 and 10 (I have JavaScript enabled in the Netscape-Options, so this cannot be the problem)?<br><br>I hope, someone will help me, it's really important.
 
I have the same problem.&nbsp;&nbsp;I'm not sure you can.&nbsp;&nbsp;In fact, I couldn't get it to work in IE either.<br><br>Oddly enough, I could not write a META tag as well.&nbsp;&nbsp;I'm going to guess it is a security precaution that netscape has to prevent this from happening.<br><br>I haven't tried it yet, but what if you created the &lt;script&gt; tag via concantenation and wrote it that way instead of writing it directly.<br><br>Otherwise, I would really like to know how to do this also.<br><br>Russ
 
I tried this way:<br>write(&quot;&lt;&quot;);<br>write(&quot;s&quot;);<br>write(&quot;c&quot;);<br>...<br><br>But this also didn't work.<br>I'll immediately ask Netscape directly. If they know a solution, i'll let you know.
 
Try setting a variable to contain the codes you want to write, and split up the problem areas, then cocantenate them.&nbsp;&nbsp;Then use the variable in the write() statement.&nbsp;&nbsp;&lt;script&gt;var newCode='&lt;ht';newCode+='ml&gt;';newCode+='&lt;scri';newCode+='pt src=whatever&gt;;newCode+='&lt;/sc';newCode+='ript&gt;';.........document.write(newCode);&lt;/script&gt;This is an ugly example, but you get the idea! :)
 
Yes; another example is at <A HREF=" TARGET="_new"> FACE=monospace>&nbsp;&nbsp;&nbsp;&nbsp;&lt;SCRIPT LANGUAGE=&quot;JavaScript1.2&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (isMenu) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;SCR&quot; + &quot;IPT LANGUAGE='JavaScript1.2' SRC='/menu\/hierArrays.js'&gt;&lt;\/SCR&quot; + &quot;IPT&gt;&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(&quot;&lt;SCR&quot; + &quot;IPT LANGUAGE='JavaScript1.2' SRC='/menu\/hierMenus.js'&gt;&lt;\/SCR&quot; + &quot;IPT&gt;&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//--&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/SCRIPT&gt;<br></font>
 
wbwzrd and rycamor,<br>&nbsp;&nbsp;&nbsp;thanks, you just helped my solve a problem that i was tearing my hair out over.<br><br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
I tried this, but it still doesn't work with Netscape.<br>It omits all the Javascript on the popup screen.<br><br>&lt;SCRIPT LANGUAGE=&quot;JavaScript1.2&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;function loadPopup(){ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;SCR&quot;+&quot;IPT LANGUAGE=\&quot;JavaScript1.2\&quot;&gt;&nbsp;&nbsp;&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.writeln(&quot;&lt;/SCR&quot;+&quot;IPT&gt; &quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&lt;/SCRIPT&gt;<br>
 
I had the same problem, still unsolve as I use another method to achieve my purpose, which is quite unrelated to this (reading in a text file).<br><br>What I want to say is that both IE5 and NC4.5 doesn't work for my case.&nbsp;&nbsp;I also tried splitting up as I noticed a book (primer plus) did so without explanation, but still cannot.<br><br>If it is indeed a security issue, could someone please confirm.<br><br>Dennis
 
I got around this problem by putting the javascript for the popup window on the screen that creates the popup window.&nbsp;&nbsp;Then I call the javascript (on the parent window) from the popup window by passing a handle to the popup window:<br>&nbsp;&nbsp;&nbsp;&nbsp;on the popup window:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;A HREF=&quot;javascript:eek:pener.applyClick(this)&quot; ...<br><br>&nbsp;&nbsp;&nbsp;&nbsp;on parent window use:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function applyClick(win){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;win.close();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top