window.onload=function(){
phonenum=document.getElementById("phonenum1").value;
//?var?vphonenum=phonenum;
//?alert(vphonenum);
//?return?false;
but=document.getElementById("but");
but.onclick=(function(){
if?(phonenum?==="")?{
alert("手機號碼不能為空,請重新輸入");
return?false;
}else{
alert(phonenum);
}
});
} 這樣寫對嗎?表單有值也會alert,沒有值也會彈出alert
判斷js input的值是否正確,看代碼
慕設計5951087
2016-11-27 22:01:13