//默认按钮处理
function KeyDownHandler()
{
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified button
document.all['<%=button1.ClientID%>'].click();
}
}
function KeyDownHandler()
{
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified button
document.all['<%=button1.ClientID%>'].click();
}
}
<!--
function document.onkeydown()
{
if(event.keyCode == 13)
{
document.all.button1.click();
}
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript>function KeyDownHandler()
{
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified button
document.all['<%=button1.ClientID%>'].click();
}
}
</SCRIPT>2:button1.ClientIDClientID表示在客户端生成的唯一标志
以便于用javascript来调用一个控件
document.all.button1.focus();
document.all.button1.click();