It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

popup and document.write problem in IE

popup and document.write problem in IE

Postby deluxmilkman on Wed Sep 26, 2007 3:20 pm

i would like to popup a window and document.write with javaScript.
The following works fine on FF, Safari, NS, both on Mac and PC, but fails in IE (6 and 7 as far as i know).
it opens a new window in IE, but it doesn't write anything. not even title.
any suggestion?


parameters are

Pic = 'pic1.jpg'
wVal = 500
hVal = 500
Name= 'nw_one'
pTitle= 'picture 1'

(new window opens in 500 x500 with title showing my xml address)

(this is written in xsl, i don't think it matters. )

[HTML]
<script language="JavaScript">
<![CDATA[


function image(Pic,wVal,hVal,pTitle,Name){

subWin = window.open("",Name,"width="+ wVal + ",height=" + hVal +",top=0,left=0");
subWin.document.open();
subWin.document.write('<html><head><title>'+pTitle+'</title>');
subWin.document.write('</head><body background="'+ Pic +'">');
subWin.document.write('</body></html>');
subWin.document.close();
subWin.focus();


}
]]>
</script>

[/HTML]



thanx or your help.:):):)
deluxmilkman
 
Posts: 8
Joined: Wed Sep 26, 2007 3:15 pm

Postby bobbyblades on Wed Sep 26, 2007 8:39 pm

LOL you should be lucky that code works in any browser, have you tried using the node functions instead of document.write ? of course I think you would need a root element to append the new Elements to and it looks like your starting with an empty document.
User avatar
bobbyblades
50+ Club
 
Posts: 85
Joined: Fri Aug 24, 2007 8:38 pm
Location: hawaii or bust

Postby deluxmilkman on Thu Sep 27, 2007 4:19 am

this worked. thanks everyone.<br>
<br>
<br><br>
[HTML]
subWin = window.open("",Name,"width="+ wVal + ",height=" + hVal +",top=0,left=0");
subWin.document.open();
subWin.document.write('<html><head><title>'+pTitle+'</title>');
subWin.document.write('</head><body background="'+ Pic +'">');
subWin.document.write('</body></html>');
subWin.document.close();
subWin.focus();
[/HTML]
deluxmilkman
 
Posts: 8
Joined: Wed Sep 26, 2007 3:15 pm


Who is online

Users browsing this forum: No registered users and 3 guests