Why would the following code not open a new browser window from with ASP.NET code behind?
Response.Write("<SCRIPT language='javascript'>mywindow= openNewWindow('','myPopUp','toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,copyhistory=0,width=400,height=300'); mywindow.document.write('<Body>I'm a new pop up window<Body>');</SCRIPT>");
The result I get is nothing. No new popup window like I was hoping for, and no error.
Thanks for any help.There seems to be a syntax error in your Javascript because of the quote in "I'm". Escape this quote: \' instead of '.
Yikes, I'm a little red faced at the moment, thanks for catching that.
In case it helps anyone else here is an example of opening a blank html page I had sitting in my asp.net project directory and filling it with some html, done from within asp.net code behind. (I was lazy and left it as one long line.)
Response.Write("<scr" + "ipt language=\"javascript\">var newWindow = window.open(\"Empty.htm\", \"newWindow\", \"location=no,menubar=no,resizable=yes,scrollbars=yes, status=no,titlebar=yes,toolbar=no,width=400,height=300\"); newWindow; newWindow.document.write(\"<Body>new pop up window<Body>\")</scr" + "ipt>");
Also note, for anyone doing this, it is possible that a popup window blocker, like available on Yahoo's toolbar or available in Norton's Internet Security application for instance could keep this popup from ever seeing the light of day.
0 comments:
Post a Comment