日期:2014-05-16  浏览次数:20385 次

js动态提交表单
<script type="text/javascript">
   function validName(){
       var name=document.getElementById("name").value;
       username=username.replace(/(^\s*)|(\s*$)/g,"");
       if(username.length==false){
            return true;
       } 
       return false;
   }

   function submit(){
       if(!validNem()){
          return false;
       }
       return true;
   }
<script>

<body>
    <form action="" method="post" name="insertForm" onsubmit="return submit()">
       <input type="text" id="name">
       <input type="submit">
    </form>
</body>