快捷键定位对象焦点 在body上加一个 onkeypress事件然后利用事件的ctrlKey 和f2的键值判断doument.all.links[0].focus(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>快捷键,设置控件焦点</title> <script> var ctrl=false; var F2=false; window.onblur=function(){ ctrl=false; F2=false; } document.onkeydown=function(){ if(event.keyCode==17){ ctrl=true; }else if(event.keyCode==113){ F2=true; }if(ctrl&&F2){ document.getElementById("getfs").focus();} } document.onkeyup=function(){ if(event.keyCode==17){ ctrl=false; }else if(event.keyCode==113){ F2=false; }} </script> </head> <body> <input name="getfs" id="getfs" ></body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>test</title><script type="text/javascript">var preKey = null;function getKeyDown(evnt){ var oEvnt = evnt? evnt:window.event; if( (preKey == 113 && oEvnt.ctrlKey) || (preKey == 17 && oEvnt.keyCode == 113) ) document.links[0].focus(); preKey = oEvnt.keyCode;}function cleanPreKey(){ preKey = null;}document.onkeydown = getKeyDown;document.onkeyup = cleanPreKey;</script></head><body><a href="1.html">1HTML</a><a href="2.html">2HTML</a><a href="3.html">3HTML</a><a href="4.html">4HTML</a><a href="5.html">5HTML</a></body></html> extjs数据显示的问题 jQuery多个异步按顺序加载问题 高手帮下忙,如何禁止执行地址栏中的JS js 上传图片如何实现? dojo,ext中extend继承如何实现的? 购物车未清空时,跳转页前判断. 请问如何在firefox中获知键盘上所按下的哪个键 遍历表格每一行中input的值 怎么把submit按钮改成图片.按下去还引发onsubmit行为? 散-------------分 菜鸟提问,急盼解答:setinterval() 缺少对象 如何将javascript中的array传递到jsp中?
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>快捷键,设置控件焦点</title>
<script>
var ctrl=false;
var F2=false; window.onblur=function(){
ctrl=false;
F2=false; }
document.onkeydown=function(){
if(event.keyCode==17){
ctrl=true;
}else if(event.keyCode==113){
F2=true;
}
if(ctrl&&F2){ document.getElementById("getfs").focus();} }
document.onkeyup=function(){
if(event.keyCode==17){
ctrl=false;
}else if(event.keyCode==113){
F2=false;
}
}
</script>
</head> <body>
<input name="getfs" id="getfs" >
</body> </html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script type="text/javascript">
var preKey = null;
function getKeyDown(evnt)
{
var oEvnt = evnt? evnt:window.event; if( (preKey == 113 && oEvnt.ctrlKey) || (preKey == 17 && oEvnt.keyCode == 113) )
document.links[0].focus();
preKey = oEvnt.keyCode;
}function cleanPreKey()
{
preKey = null;
}document.onkeydown = getKeyDown;
document.onkeyup = cleanPreKey;
</script>
</head>
<body>
<a href="1.html">1HTML</a>
<a href="2.html">2HTML</a>
<a href="3.html">3HTML</a>
<a href="4.html">4HTML</a>
<a href="5.html">5HTML</a>
</body></html>