按下 F5 后跳转到指定页面可以这样:但LZ说的刷新键是什么?不明白
<html>
<head>
<title></title>
<script>
function myRedirect(){
if(event.keyCode == 116){
event.keyCode = 0;
location.href = "http://www.sina.com.cn";
}
}document.onkeydown=myRedirect;
</script>
</head><body>
</body>
</html>
<html>
<head>
<title></title>
<script>
function myRedirect(){
if(event.keyCode == 116){
event.keyCode = 0;
location.href = "http://www.sina.com.cn";
}
}document.onkeydown=myRedirect;
</script>
</head><body>
</body>
</html>
是不是需要调整的是document.onkeydown=myRedirect; 中的onkeydown给替换为其他的呢,还是怎么做,请指教了!
感觉满奇怪的,我用本地路径替换你的新浪的路径却跳转成功,但是用新浪或者其他的网址路径却不通,什么道理?网络是通的,用网页打开是可以的!
我用的IE6,按下F5后可以跳转到新浪可以把location.href = XXX 改成 open(xxx) 试试
(别忘了协议“http://”)
至于LZ说的禁止刷新按钮,找了一下网上的资料
说只有把工具栏屏蔽掉。。
function myRedirect(){
alert( "event.keyCode of admin004:"+event.keyCode ) ;
if(event.keyCode == 116){
event.keyCode = 0;
location.href="http://www.sina.com.cn";
alert("aaa");
}
}
document.onkeydown=myRedirect; </script>
在加了alert("aaa");后,页面能够成功跳转了,请指教原因!