jiverbean wrote on 09 jan 2007 in comp.lang.javascript
:
>>
better:
onclick = "functionABC();return true;"
Whay is onclick = " functionABC();return true;" better? Are there
browsers who don't support the built-in submit event?
Would it not submit if we write return false?
Indeed, you got it.
>
I would like to suggest the following:
<script>
<script type='text/javascript'>
functionABC(myForm)
{ alert("Hello world")
myForm.submit(); }
</script>
<form name="form1" action="test.php" method="post">
<input type="button" value="submit" onclick = "functionABC">
</form>
Problem one: not functionABC but functionABC()
Problem two: this would do a "double submit" where the js submit and the
html submit each could fire first.
My advice here:
onclick = "functionABC();return false;"
If you had added terget='_blank' to the <form and [corrected the ()],
you could probably see the double submit easily.
Iassume this only works if JavaScript is enabled,
Yes JS works only when enabled.
but I always like to do field validation on forms.
Is this on topic?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)