如何让用户必须全部输入,急
一个页面有一些textbox,如果让用户必须全部输入内容。如果其中有一个没有输入点提交会提示让其输入完整,急
------解决方案--------------------两种方法,一是下面,在表单页进行控制.
<script language= "javascript ">
function chk(){
var txt1 = document.getElementById( "brand ").value;
var txt2 = document.getElementById( "schour ").value;
if (!txt1 || !txt2){
alert( "填完整 ");
return false;
}else{
alert( "ok ");
//提交表单;
}
}
</script>
<form name= "form1 " method= "post " action= "demand.asp ">
<input name= "brand " type= "text " id= "brand ">
<input name= "schour " type= "text " id= "schour ">
<input type= "submit " name= "Submit " value= "提交 " onclick= "return chk(); ">
</form>
二是在传送值的页面控制
trim(request(XXX)) <> " " or trim(request(XXXX)) <> " "......
这样判断是否填写完整均可