主题:ctrl+enter的提交问题
<script language="javascript">
function checkform()
{ if(window.event.keyCode==13&&window.event.ctrlKey){
if(checkadd()){
document.form1.submit();
}
}
}
function checkadd()
{ if(document.form1.username.value.length==0)
{ alert("阁下不会没有名字吧!");
window.form1.username.focus();
return false;
} else
{ return true;}
if(document.form1.userword.value.length==0)
{ alert("阁下难道没话想说?");
document.form1.userword.focus();
return false;
}else{
return true;
}}
</script>
<form name="form1" method="post" action="index.asp?action=add"onKeyDown="checkform();" onSubmit="return checkadd();">
现在的问题是不能对userword进行判断,还有会出现弹出两个“阁下不会没有名字吧”的对话框,我怎么改,请高手们请教~
function checkform()
{ if(window.event.keyCode==13&&window.event.ctrlKey){
if(checkadd()){
document.form1.submit();
}
}
}
function checkadd()
{ if(document.form1.username.value.length==0)
{ alert("阁下不会没有名字吧!");
window.form1.username.focus();
return false;
} else
{ return true;}
if(document.form1.userword.value.length==0)
{ alert("阁下难道没话想说?");
document.form1.userword.focus();
return false;
}else{
return true;
}}
</script>
<form name="form1" method="post" action="index.asp?action=add"onKeyDown="checkform();" onSubmit="return checkadd();">
现在的问题是不能对userword进行判断,还有会出现弹出两个“阁下不会没有名字吧”的对话框,我怎么改,请高手们请教~