当前位置:编程学习 > JS >>

常用js表单检查代码

常用js表单检查代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>

<style type="text/css">
<!--
body,td,th {
 font-size: 12px;
}
-->
</style>
<script language="javascript">
 function check(){
  if( myForm.start.value == ''){
   alert('输入数据开始位置');
   return false;
  }else if( myForm.end.value =='' ){
   alert('起始与结束位置有问题');
   return false;
  }else if( myform.pagesize.value == '' ){
   alert('请输入最大值');
   return false;
  }
 }
</script>
</head>

<body>
<table width="350" border="0" align="center" cellpadding="0" cellspacing="0" style="padding-left:20px;">
  <tr>
    <td align="left"><form id="myForm" name="myForm" method="get" action="import_test.php">
      <label></label>
      <p>
          <label>
          导入开始位置:
          <input name="start" id="start" cols="45" rows="5">
          </label>
        ex:100</p>
        <p>
          <label>总共导入数据:
          <input name="end" id="end" cols="45" rows="5" />
          </label>
        ex:15000</p>
        <p>
          <label>
          每次导入几条:
          <input type="text" name="pagesize" id="pagesize" />
          </label>
        ex:1000</p>
        <p>
          <label>
          
           <input name="button" type="submit" style="height:30px;width:300px;" id="button"  onclick="javascript:return check();" value="数据导入" />
          </label>
        </p>
    </form>    </td>
  </tr>
</table>

</body>
</html>

补充:网页制作,js教程 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,