Forum Moderators: open
[codes]<form name="form1" method="post" action="">
<label>
<input onClick="window.close();" type="submit" name="Submit" value="Submit">
</label>
</form>
[/codes]
However, the submit will still try to submit unless you return false on the form, also submit is not a valid name for a form object:
<form name="form1" onSubmit="return false;">
<input onClick="window.close();" type="submit" name="SubmitButton" value="Submit">
</form>
or, in this application, you **could** just use a button:
<form name="form1">
<input onClick="window.close();" type="button" name="SubmitButton" value="Submit">
</form>
The label tag is not necessary for a button, labels are an accessibility tag that informs readers what form object the label refers to:
<label for="email">Email:</label> <input type="text" name="email">
But if you're doing what I think you're doing, what you want is to forward the MAIN page to payPal via this small window. In which case:
in the main page:
<a href="somepage.html" onClick="newWin('somepage.html'); onClick="return false;">Click me</a>
. . . where "newWin" is whatever javascript function that opens your window. From the new window (somepage.html) this main page is referred to as the window.opener:
<form name="form1">
<input onClick="closeAndRefresh();" type="button" name="SubmitButton" value="Submit">
</form>
<script type="text/javascript">
function closeAndRefresh() {
if (window.opener &&!window.opener.closed) {
window.opener.document.location='https//www.paypal.com';
window.close();
}
}
</script>
Which should send the original opening page to paypal and close this window.
(sorry too much coffee this AM . . . .)