[OT] Question on javascript
Bart van den Eijnden
bartvde at XS4ALL.NL
Sat May 28 11:34:23 PDT 2005
Steve,
this works for me (I changed your button into a submit, and note the
return statement in the onsubmit of the form):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Submit Test</title>
<script type="text/javascript">
function nosubmit()
{
alert('nosubmit');
return false;
}
</script>
</head>
<body>
<form onsubmit="return nosubmit();">
Location: <input type="text" name="address" size="40">
<input type="submit" value="Go" onclick="alert('hello')">
</form>
</body>
</html>
Best regards,
Bart
On Sat, 28 May 2005 20:15:22 +0200, Stephen Woodbridge
<woodbri at SWOODBRIDGE.COM> wrote:
> Hi,
>
> This is a little of topic, but it is related to building a web interface
> for mapserver.
>
> I have form in html that I do NOT want to submit.
>
> http://swoodbridge.com/~woodbri/t.html
>
> enter text in location and hit [enter], the form starts a submit and
> calls nosubmit() which puts up an alert and then return false; which
> should cancel the submit. But it does the submit anyway :(
>
> This is really annoying because I figure I'm doing something stupid, but
> I just don't see it.
>
> Any help would be appreciated.
> -Steve W.
>
> the html is:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>Submit Test</title>
>
> <script type="text/javascript">
>
> function nosubmit()
> {
> alert('nosubmit');
> return false;
> }
>
> </script>
>
> </head>
> <body>
> <form onsubmit="nosubmit();">
> Location: <input type="text" name="address" size="40">
> <input type="button" value="Go" onclick="alert('hello')">
> </form>
> </body>
>
> </html>
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the MapServer-users
mailing list