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

类别:.NET开发 点击:0 评论:0 推荐:

<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>

本文地址:http://com.8s8s.com/it/it42985.htm