<form name="color" method="post" action="index.php" οnsubmit="checkSubmit();">
<input type="hidden" name="id" value="123">
<input type="submit" name="submit" value="" />
</form>
</div>
<script>
function checkSubmit(){
return false;
}
</script>
上面这段代码看起来应该可以阻止form的内容被提交到index.php里去,但实际上是不行的,为什么呢?因为οnsubmit="checkSubmut()" 这句话并没有阻止表单提交,需要改成“οnsubmit="return checkSubmut()"才可以