...

View Full Version : Process and Popup on Input Button?



Anto_J_Lareneg
10-20-2003, 01:55 AM
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();">

Basscyst
10-20-2003, 02:19 AM
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>

Anto_J_Lareneg
10-20-2003, 02:26 AM
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. ^^;

Basscyst
10-20-2003, 02:42 AM
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,scrollbars=no,resizable=no,co pyhistory=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>

Anto_J_Lareneg
10-20-2003, 03:27 AM
;__; 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.

glenngv
10-20-2003, 03:40 AM
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()">

Anto_J_Lareneg
10-20-2003, 03:49 AM
^__^ Thank you very much! That is exactly what I wanted! It works great now! :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum