我们通常的表示直接点击提交按纽进行提交页面,也可以使用回车(Enter)键来提交。
但有的网站却使用ctrl+Enter来实现提交页面,类似QQ中按ctrl+Enter发送信息。
页面上实现的方法如下:
<form name="theForm" action="http://www.aspbc.com/xxxx.asp" method="post" id="theForm">
	姓名:<input type="text" name="username" id="username" /><br />    
</form>
<script type="text/javascript">
function init(){
	document.onkeydown=function(e){
		var a=e||window.event;
		if(a.ctrlKey&&a.keyCode==13){
			if($("username").value=="")
			{
				alert('请输入姓名');
				$("username").focus();
				return false;
			}
			document.getElementById("theForm").submit();
		}
	}
}
function $(id)
{
	return document.getElementById(id);
}
window.onload=init;
</script>(鼠标移到代码上去,在代码的顶部会出现四个图标,第一个是查看源代码,第二个是复制代码,第三个是打印代码,第四个是帮助)
		
	
