javascript,判断表单是否为空,onSubmit=" return chk()" .
<script language="javascript">function chk(){var username=document.form1.username.value;var password=document.form1.password.value;if(username==""){alert("用户名不能为空");return false;}if(password==""){alert("密码不能为空");return false;}return true;}</script>
补充:web前端 , JavaScript ,