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>