日期:2014-05-18  浏览次数:20678 次

一个很小的不能输入为空的JSP问题……在线等
<form   name= "queryform "   method= "post ">
<input   type= "text "   name= "orderno "   />

INPUT为空时这个表单不能提交
用JavaScript怎么写……

忘得一干二净了。。。。各位帮帮忙

------解决方案--------------------
<head>
<script>
function sub(){

var order=document.getElementById( "orderno ");
if(order.value==null||order.value== " "){

alert( "不能为空 ");
return false;
}
return true;
}
</script>
</head>

<form name= "queryform " method= "post " onsubmit= "return sub(); ">
<input type= "text " name= "orderno " id= "orderno " />
</form>