By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

javascript not working in spawned form

P: n/a
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=90 0,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 ('&nbsp; <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.
--
Julieb215
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.