回车与button的绑定和取消

绑定
< script language = " javascript " >  
function  document.onkeydown() 

if(event.keyCode==13

document.getElementById(
"Button2").click(); 
return false
}
 
}
 

this .TextBox1.Attributes.Add( " onkeydown " , " if(event.keyCode == 13){document.getElementById('ButtonID').click(); " );


取消
if  (window.event.keyCode == 13 ) window.event.keyCode = 0

if  (window.event.keyCode == 13 return   false ;


tab跳转
if  (window.event.keyCode == 13 ) window.event.keyCode = 9

你可能感兴趣的:(button)