Page_Load:
if(!IsPostBack)
{
Button1.Attributes["onkeydown"]="if (event.keyCode==13) event.keyCode=9";
Button2.Attributes["onkeydown"]="if (event.keyCode==13) xxxxx";//需要具体看你想执行什么函数,客户端还是服务端
}
if(!IsPostBack)
{
Button1.Attributes["onkeydown"]="if (event.keyCode==13) event.keyCode=9";
Button2.Attributes["onkeydown"]="if (event.keyCode==13) xxxxx";//需要具体看你想执行什么函数,客户端还是服务端
}
var hotkey=104
var destination="index.htm"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey&&travel)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome</script>
使用说明:
其中hotkey=104的值就是热键字母的键值,你可以修改为你需要的热键
destination="index.htm"就是按了“热键”后链接的文件名。
你可以改一下:判断是热键ENTER后执行 focus就OK!
为什么不会接受!
Button1.Attributes["onkeydown"]="if (event.keyCode==13) __doPostBack('HiddenBtn',''); return false;";//HiddenBtn是个隐藏的LinkBtton
还有Button1.Attributes["onkeydown"]="if (event.keyCode==13) event.keyCode=9";
后你就会找不到标了.
Button1.Attributes["onkeydown"]这是什么事件?什么情况下触发.我照你的做了怎么没有反应
写的急,应该是TextBox1 /TextBox2
Page_Load:
if(!IsPostBack)
{
Text1.Attributes["onkeydown"]="if (event.keyCode==13) event.keyCode=9";
Text2.Attributes["onkeydown"]="if (event.keyCode==13) alert('ok')";
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
TextBox1.Attributes["onkeydown"]="if (event.keyCode==13) event.keyCode=9";
TextBox2.Attributes["onkeydown"]="if (event.keyCode==13) ss()";
}
}
private void ss()
{
TextBox1.Text ="djalkfjsd";
}这个段代码的ss()函数应该怎么调用
to ZXYSOSO(【我很想飛】)
看看我上面的例子
"if (event.keyCode==13) __doPostBack('LinkButton1',''); return false;";