G
Guest
I have an asp.net page that needs to spawn off a popup - printer friendly
page. To do that when the user clicks the printer button I fire off the
following code:
Dim jj As String
jj = "<script language = ""Javascript1.2"">var
winId=window.open('','newwin','width=600,height=900,top=50,left=50,scrollbars=yes,menubar=yes,status=yes','true');"
jj = jj & "winId.document.write('<html><header></header>');"
jj = jj & "winId.document.write ('<body><p>test</p><input
type=button value=Print onclick=window.print();>');"
jj = jj & "winId.document.write (' <input type=button
value=Alert onclick=alert(3);>');"
jj = jj & "winId.document.write('</body></html>');"
jj = jj & "</script>"
Response.Write((jj))
This causes a popup window to be displayed just fine. However I have a
couple problems with the window.
1. When the user chooses File/Send Page by email it looks like a foreign
language. Am I missing something for this to work?
2. When the user clicks the print button that fires off window.print(); -
nothing happens. The alert button works great and if I do a view source and
copy the source code into test.htm and set this as my start page, the print
button does work. It only seems to not work when being spawned off an aspx
page.
Any help would be greatly appreciated.
page. To do that when the user clicks the printer button I fire off the
following code:
Dim jj As String
jj = "<script language = ""Javascript1.2"">var
winId=window.open('','newwin','width=600,height=900,top=50,left=50,scrollbars=yes,menubar=yes,status=yes','true');"
jj = jj & "winId.document.write('<html><header></header>');"
jj = jj & "winId.document.write ('<body><p>test</p><input
type=button value=Print onclick=window.print();>');"
jj = jj & "winId.document.write (' <input type=button
value=Alert onclick=alert(3);>');"
jj = jj & "winId.document.write('</body></html>');"
jj = jj & "</script>"
Response.Write((jj))
This causes a popup window to be displayed just fine. However I have a
couple problems with the window.
1. When the user chooses File/Send Page by email it looks like a foreign
language. Am I missing something for this to work?
2. When the user clicks the print button that fires off window.print(); -
nothing happens. The alert button works great and if I do a view source and
copy the source code into test.htm and set this as my start page, the print
button does work. It only seems to not work when being spawned off an aspx
page.
Any help would be greatly appreciated.