s*****p 发帖数: 5342 | | b******y 发帖数: 9224 | 2 Not sure why. But, I guess you need to double check your form variables
first. Sometimes, javascript will still submit the form even though you
return a false in the method. But, in your case, it is kind of strange... | m******t 发帖数: 2416 | 3 An image button always submits the form like a submit button does.
So:
1. You don't need the onclick. Instead move checkForm() to
the form's onsubmit.
2. You don't need to call form.submit(). Instead either return
true or false depending on whether the input is valid.
Oh, and none of this stuff has anything to do with java, by
the way. 8-)
【在 s*****p 的大作中提到】 : I have javascript like: : function checkForm(form, url) { : ... : if ( valid == 1 ) { : form.action = url; : form.submit(); : }else { : alert( 'error message' ); : return; : }
| h*********o 发帖数: 62 | 4 change return to return false as brightguy suggested, you should be fine. |
|