Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Pop up window

  1. #1
    New Coder
    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pop up window

    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

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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>

  • #3
    New Coder
    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    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

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts

    Re: Thanks

    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>

  • #5
    New Coder
    Join Date
    Oct 2002
    Location
    Ireland
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    Thanks that worked great
    Kathryn


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •