表单验证

来源:互联网 发布:js改变元素的display 编辑:程序博客网 时间:2024/04/20 13:41

<script language="javascript">
<!--

function mycheck(f)
{
if (f.qty.value.length == 0) {
    //alert("please input qty");
    f.errmsg.value="qty is Required";
    f.qty.focus();
    return false;
}

if (f.price.value.length == 0) {
    //alert("please input price");
    f.errmsg.value="price is Required";
    f.price.focus();
    return false;
}

if (f.req_date.value.length == 0) {
    //alert("please input req_date");
    f.errmsg.value="req. date  is Required";
    f.req_date.focus();
    return false;
}

return true;
}
-->
</script> 

 

 

<form method=post onsubmit='return mycheck(this)'  id=form" & intpid & " action=aaa.aspx?pid=" & intpid & ">

 

</form>