469,640 Members | 1,561 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,640 developers. It's quick & easy.

include the same javascript in created code with secondWindow.document.writeln()

Hello,

I want to open a new window with javascript:
secondWindow=window.open(...)
secondWindow.document.writeln(...)

I wrote the javascript code into a separate file secondwindow.js.

I need in the new window the same javascript code, therefore:
secondWindow.document.writeln('<script type="text/javascript"
language="javascript1.2" src="../../js/secondwindow.js"><\/script>');

Just this line makes problems in Internet Explorer (without reaction),
not always and not in all Internet Explorer versions.
Netscape, Opera and Mozilla work without problems.

I tested successfully with w3c validator the XHTML code which created
with secondWindow.document.writeln().

What is the reason? How can I resolve this problem?
Thank you for your hints, Eels

Aug 20 '05 #1
2 1636
ASM
eels wrote:
Hello,

I want to open a new window with javascript:
secondWindow=window.open(...)
secondWindow.document.writeln(...)

I wrote the javascript code into a separate file secondwindow.js.
why won't you use mother's JS ?

opener.onefunction(arg1,arg2);
I need in the new window the same javascript code, therefore:
secondWindow.document.writeln('<script type="text/javascript"
language="javascript1.2" src="../../js/secondwindow.js"><\/script>');


try with something as follow :

var myCode = '<html><head><title>new window<\/title>'
myCode += '<script type="text/javascript" language="javascript1.2"'+
'src="../../js/secondwindow.js"><\/script>';
myCode += '<\/head><body>' // and so on ...

with(secondWindow.document) {
open();
write(myCode);
close();
}
If that doesn't solve your IE problems, could try with :
secondwindow.js">'+'<'+'/script>';
insteed of :
secondwindow.js"><\/script>';

'<'+'/head><body>'
insteed :
'<\/head><body>'

--
Stephane Moriaux et son [moins] vieux Mac
Aug 20 '05 #2
Hello,

the hint
var myCode = '<html><head><title>new window<\/title>'
myCode += '<script type="text/javascript" language="javascript1.2"'+
'src="../../js/secondwindow.js"><\/script>';
myCode += '<\/head><body>' // and so on ...

with(secondWindow.document) {
open();
write(myCode);
close();
} gives the solution.
Thank you Eeels.

ASM schrieb:
eels wrote:
Hello,

I want to open a new window with javascript:
secondWindow=window.open(...)
secondWindow.document.writeln(...)

I wrote the javascript code into a separate file secondwindow.js.


why won't you use mother's JS ?

opener.onefunction(arg1,arg2);
I need in the new window the same javascript code, therefore:
secondWindow.document.writeln('<script type="text/javascript"
language="javascript1.2" src="../../js/secondwindow.js"><\/script>');


try with something as follow :

var myCode = '<html><head><title>new window<\/title>'
myCode += '<script type="text/javascript" language="javascript1.2"'+
'src="../../js/secondwindow.js"><\/script>';
myCode += '<\/head><body>' // and so on ...

with(secondWindow.document) {
open();
write(myCode);
close();
}
If that doesn't solve your IE problems, could try with :
secondwindow.js">'+'<'+'/script>';
insteed of :
secondwindow.js"><\/script>';

'<'+'/head><body>'
insteed :
'<\/head><body>'

--
Stephane Moriaux et son [moins] vieux Mac


Aug 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by John Ortt | last post: by
4 posts views Thread by lmarceglia | last post: by
2 posts views Thread by suhy | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.