如下是例子的部分代碼(
<script type="text/javascript">
$(document)
onlyNum("test");
}
//文本框只能輸入數字
function onlyNum(id){
$("#"+id)
{ var keyCode = event
if (keyCode ==
{ return true; }
else { return false } }
)
{ this
);
}
//文本框只能輸入數字和小數點
function pageOnlyNumber(evt){
evt = (evt) ? evt : window
keyCode = evt
if((keyCode <
{
if(window
window
}
else{
evt
}
}
}
</script>
<input type="text" id="APPLY_FEE_RATE" name="APPLY_FEE_RATE" onkeypress="pageOnlyNumber(event)" maxlength="
<input type="text" name="test" id="test" value=
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25507.html