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!

popup and document.write problem on IE

Status
Not open for further replies.

deluxmilkman

Programmer
Sep 26, 2007
17
0
0
JP
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?


paramaters are

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

(new window opens in 500 x500.)

(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>



thanx or your help.:):):)
 
Works for me. I'd make sure by viewing thw window source that the xsl transformation is producing the correct script.

Cheers,
Dian
 
Make sure your CDATA is commented
Code:
    <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>

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top