<html>
<head>
<title>Test Doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<SCRIPT LANGUAGE="JavaScript">
<!--
function EnterTo(){
if (window.event.keyCode == 13){
form1.submit();
}
}
//-->
</SCRIPT>
</head><body>
<form name="form1" id="form1">
<input type="text" id="TestText" name="TestText" value="" onKeyPress="EnterTo()">
</form>
</body>
</html>
<head>
<title>Test Doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<SCRIPT LANGUAGE="JavaScript">
<!--
function EnterTo(){
if (window.event.keyCode == 13){
form1.submit();
}
}
//-->
</SCRIPT>
</head><body>
<form name="form1" id="form1">
<input type="text" id="TestText" name="TestText" value="" onKeyPress="EnterTo()">
</form>
</body>
</html>
解决方案 »
- uploadify在同一域之下IIS用Windows验证上传问题
- 怎么获取不同gridpanel的id值?
- 表格在单元格范围内,漂浮在一固定位置(分全给,写得好另付RMB)
- thead的问题
- 超简单的问题,不需要一分钟。
- JS 中如何使用XMLhttp?
- 如何让第一个input框聚焦,我用focus不行,我是在struts1.1里面
- *.js文件中document.write("akshf")无输出的问题
- fullpage.js不使用鼠标滚动,但导航依然有效的方法
- 悬赏:求JS跨域的解决方法
- js中如何得到jsp页面中的ArrayList的值?
- javascript函数中能否调用java函数??
这个示例实现的是,当你在第一个文本框输完内容后,直接切换到最后一个按钮上
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
这个文本框1:<BR><input type="text" name="text1" value="" tabindex=1 onkeydown="if(event.keyCode==13)event.keyCode=9"><br>
这个文本框2:<BR><input type="text" name="text2" value="" ><br>
<input type="button" value="button" tabindex=5><br>
切换至这个按钮:<BR><input type="button" value="button" tabindex=2 onclick="alert('hello')"><br>
</BODY>
</HTML>
onkeydown="if(event.keyCode==13)document.all.inputId.click()"
同意大梅的,触发事件