...

View Full Version : Pop up window



kathryn
07-03-2003, 02:46 PM
Hi,
I have an HTML form with a radio button.
When the user clicks a button I would like a new window to open with a different HTML page and have the print screen available to print the contents.
Thanks, Kathryn

arnyinc
07-03-2003, 03:13 PM
use this page to popup the window after clicking on the radio button.

<html>

<head>
<script language="javascript">
function popup(){
var mypop=window.open("the_page_you_want_to_print.htm", "printme", "height=400, width=400")
}
</script>
</head>
<body>
<form>
<input type="radio" onclick="popup();">
</form>
</body>
</html>

Use this page to display the print screen on your popup. This would be named the_page_you_want_to_print.htm if you keep the same ridiculous naming scheme that i did :)

<html>
<body onload="window.print()">
The stuff you want to print.
</body>
</html>

kathryn
07-03-2003, 04:44 PM
Thanks that worked great ...
Another question though!!!
Is there any way to pass JSP variables (perhaps in the javascript function) from the original page to the pop-up window??
Kathryn

arnyinc
07-03-2003, 05:11 PM
Originally posted by kathryn
Is there any way to pass JSP variables (perhaps in the javascript function) from the original page to the pop-up window??

I'm not too familiar with JSP, but this should be close.

[page1.jsp]
<html>
<head>
<script language="javascript">
function popup(){
var mypop=window.open("page2.asp?yourvar=<% out.println(yourvar);%>", "printme", "height=400, width=400")
}
</script>
</head>
<body>
<form>
<input type="radio" onclick="popup();">
</form>
</body>
</html>

[page2.asp]
<html>
<body onload="window.print()">
<%
'get the value of the variable here... not sure how in jsp
%>
</body>
</html>

kathryn
07-04-2003, 08:55 AM
Thanks that worked great
Kathryn



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum