PDA

View Full Version : create a pop-up window


conceptmgt
10-08-2002, 02:56 PM
Hi

How do I create a pop-up window from a form with 2 submit buttons? Only 1 of the submit buttons needs the pop-up, when I press a submit button it calls a function that sets the forms parameters

function apurchase()
{
document.theform.action = "https://vault1.secured.asp
document.theform.target = "_new"
document.theform.submit();
}


Any ideas,

ThanksGary

beetle
10-08-2002, 04:10 PM
This what you need?function apurchase(type) {
document.theform.action = "https://vault1.secured.asp
document.theform.target = "_new"
if (type==2) window.open('popup.htm','','');
document.theform.submit();
}

<input type="button" value="Submit 1" onClick="apurchase(1)">
<input type="button" value="Submit 2" onClick="apurchase(2)">

conceptmgt
10-08-2002, 04:21 PM
Hi

I need to be able to request the form (using asp) so I don't think this will work. As it will need to be submitted

Thanks

beetle
10-08-2002, 04:43 PM
Originally posted by conceptmgt
As it will need to be submitted What do you suppose this little sucker right here does?function apurchase(f, type) {
f.action = "https://vault1.secured.asp
f.target = "_new"
if (type==2) window.open('popup.htm','','');
f.submit(); <---- :D
}

<input type="button" value="Submit 1" onClick="apurchase(this.form, 1)">
<input type="button" value="Submit 2" onClick="apurchase(this.form, 2)">Note: I re-wrote the function to make it a bit more efficient/portable