位置:海鸟网 > IT > ASP.NET >

[ASP.NET]按键跳转以及按Enter以不同参数提交,及其他感应事件

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>按键跳转测试</title>
<script language=javascript>
function keypress()
{
akey = event.keyCode;
if(akey ==13)
{
GotoUrl = 'Find.aspx?'+event.srcElement.name+'='+event.srcElement.value;
window.open(GotoUrl);
}
}
function keytab1(event)
{
akey = event.keyCode;
if(akey ==13)
{
document.forms[0].USERADDR.focus();
}
}
function keytab2(event)
{
akey = event.keyCode;
if(akey ==13)
{
document.forms[0].USERPHONE.focus();
}
}
function convertToUpper(textbox)
{
textbox.value = textbox.value.toUpperCase();
}

function checkNum(str)
{
return str.match(/D/)==null
}

</script>
<style>
<!--
body { font-size: 10pt; font-family: 宋体 }
div { border-style: ridge; border-width: 1px; padding: 10px; background-color:#DAF4FE }
-->
</style>
</head>

<body >
<div>
<FORM method="post">
<b>查询条件</b>
<HR>
用户编码:<INPUT type="text" size="20" onkeypress="keypress()" ><font face="Webdings">N</font><br>
用户姓名:<INPUT type="text" size="20" onkeypress="keypress()" ><font face="Webdings">N</font><br>
用户电话:<INPUT TYPE="text" onkeypress="keytab1(event)" ><br>
用户地址:<INPUT TYPE="text" onkeypress="keytab2(event)" >
</FORM>
</div>
</body>

</html>