2
如何解決它:處理自動IP輸入?
<input id="ip" onkeyup="IP();">
這是腳本:
function IP(){
document.getElementById('IP').value = document.getElementById('IP').value.replace(/[^0-9 .]/g,"");
var ip = document.getElementById('IP').value;
ipparts= new Array();
ipparts = ip.split('.');
L=((ipparts.length)-1);
if(L<=2){
if (ipparts[L]>=26 && ipparts[L]<=99 || ipparts[L]>=100 &&ipparts[L]<=255 && dot==0){
document.getElementById('IP').value +='.';
}
}
}
我需要劇本時,如果用戶把點忽略它自動把圓點。
'。 = ASCII中的= 190 ---甚至不接近http://www.asciitable.com/。它是ASCII中的「dec 46」 – zerkms
爲什麼我覺得它是190. – Achrome
如何將關鍵代碼發送到腳本?哪個函數? – Maysam