1只能輸入正整數的:
<input class="textinput" type="text" name="bjdj" value="" maxlength="10"
onkeyup="value=value.replace(/[^(/d)]/g,'') " onfocus="this.select()"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^(/d)]/g,''))"/>
2 只能輸入數值類型的,包括小數
<input class="textinput" type="text" name="bjdj" value="" maxlength="10"
onkeyup="value=value.replace(/[^(/d|/.)]/g,'') " onfocus="this.select()"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^(/d|/.)]/g,''))"/>
其實上面差異不大,就是將第一個在正則表達式驗證上加上了去除掉小數點驗證。