Client Side Script window.open

S

Sam

Does anyone know if I can write a whole webpage content stored in a variable
to a popup window? The variable that I'm talking about is a string variable
which has its content generated by an aspx page). Now if I write the content
of this variable to a file (let's say mypage.htm) and open it using
window.open('mypage.htm',name,attrib);" then everything works just fine. The
problem is that I have to generate the content of this page on fly to output
to a new popup window. Could someone give me a hand? Thank you

Regards,

Sam

Below is what I have in my event handler which it keeps giving me different
kind of errors and a window will popup. Now if take out this line sScript &=
osb, everything would look fine



Dim sScript As String
sScript &= "<script language=javascript>"
sScript &= "var name = 'mypopup';"
sScript &= "var attrib =
'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=250,height=250';"
sScript &= "popupwin = window.open('',name,attrib);"
sScript &= "popupwin.document.open();"

sScript &= "popupwin.document.write("
sScript &= """"
sScript &= osb
sScript &= """"
sScript &= ");"

sScript &= "</script>"

Response.Write(sScript)
 
L

Laurent Bugnion

Hi,
Does anyone know if I can write a whole webpage content stored in a variable
to a popup window? The variable that I'm talking about is a string variable
which has its content generated by an aspx page). Now if I write the content
of this variable to a file (let's say mypage.htm) and open it using
window.open('mypage.htm',name,attrib);" then everything works just fine. The
problem is that I have to generate the content of this page on fly to output
to a new popup window. Could someone give me a hand? Thank you

Regards,

Sam

You can if you use JavaScript.

Once you open the window, you can use the reference you get to get the
pop-up's document and write to it:

var strHtml = "Hello world<br />How are you?";

var wPopUp = window.open( "", "wPopUp", attrib );
wPopUp.document.writeln( strHtml );
wPopUp.document.close();

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top