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

Javascript and Netscape 4.7

P: n/a
Hello,

excuse me in advance for my poor english...

I have a problem with NS 4.7 (I know, it is old, but I have no
choice...) :

So, I have a page with a link to open a new window:

var strHtml = '<html><head><title>title_of_window</title>' +
'<LINK rel=stylesheet href=theme.css>'+
'<SCRIPT LANGUAGE="JavaScript" SRC="my_script.js"></SCRIPT>' +
'</HEAD><BODY onLoad="fonc_onLoad();" class=Body topmargin=0
leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0>' +
'blablabla' +
'</body></html>';

var win = window.open('', 'window_name', 'parameters');
win.document.write(strHtml);
win.document.close();
win.focus();
My problem concerns the tag "onLoad " of the "BODY" tag: with IE, the
"fonc_onLoad()" starts normally (this function is in "my_script.js"),
but with NS 4.7 (ou 4.51), the <SCRIPT> tag is ignored (you can view the
window's source code), so the "fonc_onLoad()" function cannot not start.

Any help would be highly appreciated.
Thank you very much in advance.

--
Yours sincerely, Thierry

Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


Cenékemoi wrote:
Hello,

excuse me in advance for my poor english...

I have a problem with NS 4.7 (I know, it is old, but I have no
choice...) :

So, I have a page with a link to open a new window:

var strHtml = '<html><head><title>title_of_window</title>' +
'<LINK rel=stylesheet href=theme.css>'+
'<SCRIPT LANGUAGE="JavaScript" SRC="my_script.js"></SCRIPT>' +
'</HEAD><BODY onLoad="fonc_onLoad();" class=Body topmargin=0
leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0>' +
'blablabla' +
'</body></html>';

var win = window.open('', 'window_name', 'parameters');
win.document.write(strHtml);
win.document.close();
win.focus();
My problem concerns the tag "onLoad " of the "BODY" tag: with IE, the
"fonc_onLoad()" starts normally (this function is in "my_script.js"),
but with NS 4.7 (ou 4.51), the <SCRIPT> tag is ignored (you can view the
window's source code), so the "fonc_onLoad()" function cannot not start.

Any help would be highly appreciated.
Thank you very much in advance.


Try to insert some dummy script e.g.
strHTML = '<html><head><title>...<\/title>'
+ '<script type="text/javascript">var dummy = 1;<\/script>'
+ '...'
that sometimes helps that NN4 recognizes your script

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a


Salut de l'australie...

Thierry wrote:
I have a problem with NS 4.7

I have a page with a link to open a new window:

var strHtml = '<html><head><title>title_of_window</title>' +
'<LINK rel=stylesheet href=theme.css>'+
'<SCRIPT LANGUAGE="JavaScript" SRC="my_script.js"></SCRIPT>' +
The first problem occurs here:
</SCRIPT>
will terminate parsing of the javascript block in which this code has
been written. It needs to be escaped to
<\/SCRIPT>
even though it occurs within a quoted string.
'</HEAD><BODY onLoad="fonc_onLoad();" class=Body topmargin=0
leftmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0>' +
'blablabla' +
'</body></html>';

var win = window.open('', 'window_name', 'parameters');
win.document.write(strHtml);
win.document.close();
win.focus();


There are two more related problems that I know of:

a) When writing "<\/SCRIPT>" within generated content, it needs to be
the last thing written in a single call to document.write. If not, NS4
can produce layout errors. If necessary, break up strHTML into pieces
and write them separately. I can not say that this bug will affect your
page for sure, but the bug certainly exists.
b) NS4 has trouble loading external javascript files within pages
generated by pages loaded using the "file://" protocol. Testing this
page most likely needs to be done using a server.
(For testing on my local machine, I use Personal Web Server (PWS) under
Windows 98, or Appache under Windows XP.)
amicalement,

Dom

Jul 20 '05 #3

P: n/a
Bonjour (from France) ŕ Dom Leonard
<do*************@senet.andthis.com.au> qui nous a
écrit :
Salut de l'australie...

There are two more related problems that I know of:

a) When writing "<\/SCRIPT>" within generated content, it needs to
be the last thing written in a single call to document.write. If not,
NS4 can produce layout errors. If necessary, break up strHTML into
pieces and write them separately. I can not say that this bug will
affect your page for sure, but the bug certainly exists.
here, it is not necessary...
b) NS4 has trouble loading external javascript files within pages
generated by pages loaded using the "file://" protocol. Testing this
page most likely needs to be done using a server.
Thank you very much, you are right !...
(For testing on my local machine, I use Personal Web Server (PWS)
under Windows 98, or Appache under Windows XP.)
amicalement,

Dom


--
Cordialement, Thierry ;-)

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.