首页 > 编程 > .NET > 正文

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

2024-07-10 13:05:29
字体:
来源:转载
供稿:网友
菜鸟学堂:
<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 onload="javascript:document.forms[0].userid.focus()">
<div style="width=254px; height:134px">
<form method="post">
<b>查询条件</b>
<hr>
用户编码:<input type="text" name="userid" size="20" onmouseover="this.focus()" onkeypress="keypress()" onfocus="this.select()"><font face="webdings">n</font><br>
用户姓名:<input type="text" name="username" size="20" onmouseover="this.focus()" onkeypress="keypress()" onfocus="this.select()"><font face="webdings">n</font><br>
用户电话:<input type="text" name="userphone" onmouseover="this.focus()" onchange="converttoupper(this)" onkeypress="keytab1(event)" onfocus="this.select()"><br>
用户地址:<input type="text" name="useraddr" onmouseover="this.focus()" onchange="converttoupper(this)" onkeypress="keytab2(event)" onfocus="this.select()">
</form>
</div>
</body>

</html>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表