Posted by Shelly on 10/18/06 02:53
I was a little too quick in replying. I have four buttons that should not
open a new window and two that should. In my actual application I sent it
to redir.php in the Javascript. Once there in redir.php, I test on which of
the two buttons in the original page activated it and then send it to the
proper page.
The problem is that even though I only added the onclick to the two buttons
for a new page, ALL six buttons go to redir.php AND open a new window. (I
have the tests on the four other buttons in the original page.)
Can you think of any reason why the buttons that do not have the onclick
would execute the Javascript and go to redir.php? I placed the script just
inside <body> and before <form>.
Here is the actual code snippet for a button for a new page:
<input type="submit" value="Click Here To" name="health"
onclick="form_new_window(this)"
style="color: #E1D2AA; border: 2px solid; border-color:
#CD968F #610E08 #400906 #B14F46; background-color: #99160C; font-family:
Verdana; font-size: 12px; display: block; height: 25px; width: 148px;
font-weight: bold; margin: 3px; padding: 2px; padding-bottom: 5px;
vertical-align: middle;" />
and here is one for not a new page:
<input type="submit" value="Click Here To" name="shop"
style="color: #E1D2AA; border: 2px solid; border-color:
#CD968F #610E08 #400906 #B14F46; background-color: #99160C; font-family:
Verdana; font-size: 12px; display: block; height: 25px; width: 148px;
font-weight: bold; margin: 3px; padding: 2px; padding-bottom: 5px;
vertical-align: middle;" />
and the Javascript is:
<body>
<script type="text/javascript">
function form_new_window(button){
var form = button.form;
form.action = 'redir.php';
form.method = 'POST';
form.target = '_blank';
return true;
}
</script>
<form ....>
[Back to original message]
|