function test(){
var value=document.getElementById("id");
if(value==""){
alert("内容为空");
}
}
function passw_ens() { var pw1=document.getElementById("new_pw").value; if(pw1!=null) { alert("no problem"); } else{ alert(" 文本框没有值"); } }
获取到输入框的值,if判断一下是不是等于“”