[web] Javascript Popup Window

Started by
0 comments, last by Ibatex 16 years, 6 months ago
I have a basic popup window with &#106avascript:

function CouponPopup(url, title, info1, info2, width, height)
{
	try
	{
		var winWidth = parseInt(width)+17;
		var winHeight = parseInt(height)+65;
		var popupWin = window.open('about:blank','coupon','scrollbars=yes,menubar=no,height='+winHeight+',width='+winWidth+',resizable=yes,toolbar=no,location=no,status=no');
		popupWin.document.write('<html><head><title>Coupon</title></head><body>');
		popupWin.document.write('<img src="'+url+'"><br>');
		popupWin.document.write(title+'<br>');
		popupWin.document.write(info1+'<br>');
		popupWin.document.write(info2+'<br>');
		popupWin.document.write('</body></html>');
		return;
	} catch(ex) { alert(ex); }
}

Everything works fine, but something is driving me crazy. In Firefox, after this popup window opens, the status bar just "hangs" as if it's loading something, even though it's not. Does anybody know how to get this status bar to go away? Thanks.
http://blog.protonovus.com/
Advertisement
A simple popupWin.document.close() when you're finished with the output should do the trick. Also document.write is most efficient when you assemble everything you want to write in a variable and document.write it in one swoop.

[Edited by - Ibatex on October 4, 2007 12:49:15 AM]

This topic is closed to new replies.

Advertisement