I am trying to implement a simple JavaScript of redirecting my window
to a new URL upon clicking a submit button. This is an easy task except
when I have to put an input type='submit' in front of the onClick
command. It always commits the CGI action, and skip the URL redirect
part. The example code is below
<form action=mycgi.pl>
<input type='submit' name=submit value='Submit'
onClick="window.location.href='http://myserver.com'">
</form>
I know if "type=button" is used here, the script can work, but I have
to use "type=submit" for some particular reasons in my project.
Does anyone have a good way to circumvent this problem? Appreciate your
time!
Hongyu