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";//需要具体看你想执行什么函数,客户端还是服务端
}
解决方案 »
- .Net MVC 3.0中Html.Editor、Html.EditorFor、Html.TextBoxFor之间有什么区别?
- fckeditor如何针对不同用户来限制某些功能?
- 我用Console.WriteLine("This ")怎么什么都不显示呢?
- 我想问一下用aspx实现模版代码分离这个功能要怎么实现的?
- 在web中如何实现生成EXCEL表格?
- 在网页中调用本地的应用程序不成功,请指点!
- 各位,我想找个可以可靠发送EMAIL的事例程序,请帮忙!
- 大转盘概率原理
- asp.net的困惑
- 那里有比较完整的用asp.net写的比较简单例字下载?
- 请问 win2000支持 oracle microsoft transaction server吗
- owc创建统计图导出gif失败!问了几次和几个论坛都没解决,哪位大哥给个提示也行!
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;";