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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Oct 2003
    Location
    Huntington Beach, CA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Process and Popup on Input Button?

    I've been playing with this script for a bit now, it's for a quiz I am making, I got each code to work fine on thier own.. so it's no problems with that. I just want the results of the Quiz to pop-up in a popup window. To do this I have to have process and popup assigned to the same input button.
    I got this code to make a popup window and process.. but it processes in the same window.. and it makes a blank popup appear. c_c;
    Here is the code, maybe someone here can help me? ^^;

    <input type="button" Value="Submit!" onclick="window.open('yoururlhere.html', 'Sample', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=y es,width=500,height=500');process();">

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    If I understand correctly this should work. If you want the process() to happen IN the new window on the other hand. That is different.

    <html>
    <head>
    <script language="javascript">
    function newWin(url){
    new_win=window.open(url,'new_win')
    }
    function process()
    {
    alert("My Process");
    }

    </script>
    </head>
    <body>
    <input type="button" value="GO!" onclick="newWin('http://www.codingforums.com');process();new_win.focus();">
    </body>
    </html>

  • #3
    New to the CF scene
    Join Date
    Oct 2003
    Location
    Huntington Beach, CA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the help, but that isn't what I wanted. 0o; the "process();" is supposed to give the results of the quiz, and I wanted the results of the quiz to appear in a popup window like the one I had defined. ^^;

  • #4
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Kinda hard to tell without some code but this might get you started.

    <html>
    <head>
    <script language="javascript">
    function newWin(){

    var str="Test Results"
    new_win=window.open("",'new_win','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollb ars=no,resizable=no,copyhistory=y
    es,width=500,height=500');
    new_win.document.write(str);
    }



    </script>
    </head>
    <body>
    <input type="button" value="GO!" onclick="newWin();new_win.focus();">
    </body>
    </html>
    Last edited by Basscyst; 10-20-2003 at 02:18 AM.

  • #5
    New to the CF scene
    Join Date
    Oct 2003
    Location
    Huntington Beach, CA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ;__; that code doesn't even work.. geh. Okay.

    http://notopinionated.theanto.org/indigalian.php

    That is the page I am having the problems with. I'd like to have the quiz results open in that page ( they aren't done yet, but I'd know if it worked ). But the code I have opens a popup, but it also makes the quiz results open in the parent window. Yeah.

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,946
    Thanks
    0
    Thanked 236 Times in 233 Posts
    function process(){
    ...
    location.href = out + ".php";
    }

    Change that location.href line to:

    var w = window.open(out + ".php", "result","width=500,height=500");
    w.focus();

    then the button:

    <input type="button" Value="Submit!" onclick="process()">

  • #7
    New to the CF scene
    Join Date
    Oct 2003
    Location
    Huntington Beach, CA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ^__^ Thank you very much! That is exactly what I wanted! It works great now!


  •  

    Posting Permissions

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