作者othree (OOO)
看板Web_Design
标题Re: [问题] submit後disable button
时间Mon Jul 2 00:39:21 2007
: 不知道为什麽会出现上面的情况,这样我就没办法判断使用者有没有按下submit
: 请问这部分程式码该怎麽写才能抓到submit呢?谢谢!
确实是因为按钮被disable才不会送他的值过去
如果你一定要多个送出钮的话
可以用全域变数或是给任一个element多个属性
後者范例
<script>
function check(f) {
if (f.send)
return false;
else
return f.send = true;
}
</script>
<form onsubmit="return check(this);">
<input type="submit"/>
</form>
function还可以改成一行
function check(f) {
return (f.send)?false:f.send = true;
}
然後可以改成一行就可以塞到表单那
<form onsubmit="return (this.send)?false:this.send = true;">
<input type="submit"/>
</form>
不过尽量能把js和html分开比较好啦
--
http://blog.othree.net/
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.118.5.39
※ 编辑: othree 来自: 140.118.5.39 (07/02 00:56)