日期:2014-05-16 浏览次数:20469 次
<form name="form1" action=""> <input type="text" name="username"> <input type="button" name="submitForm" value="提交" onclick="submitForm1();"> </form> <script> function submitForm1(){ var result=window.showModalDialog("myconfirm.html", 2,"dialogWidth:240px;dialogHeight:120px;status:no;"); if(result==1){ check(document.getElementsByName("form1")[0]); } } function check(frm){ var username=document.getElementsByName("username")[0]; var result; if(username.value==""){ result=window.showModalDialog("myconfirm.html", new Array(1,"请输入用户名"),"dialogWidth:240px;dialogHeight:120px;status:no;"); return; } frm.submit(); } </script>