上次學到一招如何驗證使用者是否都是輸入數值或文字

 function checkNum(str){return str.match(/\D/)==null}

或參考篇文章

http://phone.idv.tw/cs2/forums/post/73.aspx

function onKeyPressBlockNumbers(e)
{
var key = window.event ? e.keyCode : e.which;
var keychar = String.fromCharCode(key);
reg = /\d/;
return !reg.test(keychar);
}
...
 

arrow
arrow
    全站熱搜

    ROACH 發表在 痞客邦 留言(0) 人氣()