用键盘选择跳转
用键盘选择跳转
<style>
body,td,a{font-size:9pt;color:white}
</style>
<body bgcolor="#005cb0">
<script>
choice_sys=new Array();//记录可以选择的站点
choice_sys[0]=new Array("百度首页","http://www.baidu.com");
choice_sys[1]=new Array("我的站点","http://ameng.cnblogs.com");
choice_sys[2]=new Array("新浪首页","http://www.sina.com.cn");
choice_sys[3]=new Array("搜狐首页","http://www.sohu.com");
var tTop="<table id=\"choiceing\">",tBody="",tBottom="</table>";
for(i=0;i<choice_sys.length;i++)tBody+="<tr><td>"+(i+1)+"."+choice_sys[i][0]+"</td></tr>";
document.body.innerHTML+=tTop+tBody+tBottom;
document.body.innerHTML+="<hr size=\"1\" width=\"250\" align=\"left\" color=\"ffffff\">现在你
按回车就可以跳转到选择的网站连接中,至于时间控制稍后就做
."
choice=new Array();//用来记录当前选择的行在document中的索引
for(i=0;i<choice_sys.length;i++)choice[i]=choiceing.children(0).children(i).children(0).source
Index;
document.all[choice[0]].style.background="#ffcc00";
document.all[choice[0]].style.color="#000000";
var c_NO=0;//记录选择情况
function document.onkeydown(){
if(event.keyCode==40&&c_NO<choice.length-1){
document.all[choice[c_NO]].style.background="";
document.all[choice[c_NO]].style.color="#ffffff";
document.all[choice[c_NO+1]].style.background="#ffcc00";
document.all[choice[c_NO+1]].style.color="#000000";
c_NO++;
}
if(event.keyCode==38&&c_NO>0){
document.all[choice[c_NO]].style.background="";
document.all[choice[c_NO]].style.color="#ffffff";
document.all[choice[c_NO-1]].style.background="#ffcc00";
document.all[choice[c_NO-1]].style.color="#000000";
c_NO--;
}
if(event.keyCode==13){
location=choice_sys[c_NO][1];
}
}
</script>
body,td,a{font-size:9pt;color:white}
</style>
<body bgcolor="#005cb0">
<script>
choice_sys=new Array();//记录可以选择的站点
choice_sys[0]=new Array("百度首页","http://www.baidu.com");
choice_sys[1]=new Array("我的站点","http://ameng.cnblogs.com");
choice_sys[2]=new Array("新浪首页","http://www.sina.com.cn");
choice_sys[3]=new Array("搜狐首页","http://www.sohu.com");
var tTop="<table id=\"choiceing\">",tBody="",tBottom="</table>";
for(i=0;i<choice_sys.length;i++)tBody+="<tr><td>"+(i+1)+"."+choice_sys[i][0]+"</td></tr>";
document.body.innerHTML+=tTop+tBody+tBottom;
document.body.innerHTML+="<hr size=\"1\" width=\"250\" align=\"left\" color=\"ffffff\">现在你
按回车就可以跳转到选择的网站连接中,至于时间控制稍后就做
."choice=new Array();//用来记录当前选择的行在document中的索引
for(i=0;i<choice_sys.length;i++)choice[i]=choiceing.children(0).children(i).children(0).source
Index;
document.all[choice[0]].style.background="#ffcc00";
document.all[choice[0]].style.color="#000000";
var c_NO=0;//记录选择情况
function document.onkeydown(){
if(event.keyCode==40&&c_NO<choice.length-1){
document.all[choice[c_NO]].style.background="";
document.all[choice[c_NO]].style.color="#ffffff";
document.all[choice[c_NO+1]].style.background="#ffcc00";
document.all[choice[c_NO+1]].style.color="#000000";
c_NO++;
}
if(event.keyCode==38&&c_NO>0){
document.all[choice[c_NO]].style.background="";
document.all[choice[c_NO]].style.color="#ffffff";
document.all[choice[c_NO-1]].style.background="#ffcc00";
document.all[choice[c_NO-1]].style.color="#000000";
c_NO--;
}
if(event.keyCode==13){
location=choice_sys[c_NO][1];
}
}
</script>
浙公网安备 33010602011771号