1. <script language="javas
function document.on
{
if(event.keyCode==13)
{
document.getElementById("BtnSearch").click(); //点击事件被触发
return false; }
}
</script>
2.在文本框中按回车触发事件
<script type="text/javas
function EnterRedirect(Obj)
{
if(event.keyCode==13)
Obj.click();
}
</script>
<input on
3.
一//直接在js中写
<script language="javas
function EnterTextBox()
{
if(event.keyCode == 13 && document.all["TextBox1"].value != "")
{
event.keyCode = 9;
event.returnValue = false;
document.all["TextBox1"].click();
}
}
</script>
<body on
//此处TextBox1为页面上TextBox的ID
二.
<script language="javas
function EnterTextBox(button)
{
if(event.keyCode == 13 && document.all["TextBox1"].value != "")
{
event.keyCode = 9;
event.returnValue = false;
document.all[button].click();
}
}
</script>
在PageLoad事件里
TextBox1.Attribute.add("on
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ppvoid/archive/2007/06/14/1652831.aspx