<script>
function check_form(){
if ...
return false;
}
</script>
<form onsubmit="return check_form()"> ... </form>or
<input type="submit" onclick="return check_form()">
在function中return false僅會終止該function的作用
故必須在onsubmit/onclick中的function name前方加上"return"
將false傳至form的submit予以中斷
NOTE:
若無法順利中斷submit,檢查function內容!
確認return false前是否有錯誤的statement~
沒有留言:
張貼留言