标签:
HTML部分:
<div class="upnext">
<a title="上一条" class="up" id="up" href="#"><span>上一条</span></a>
<a title="下一条" class="next" id="next" href="#"><span>下一条</span></a>
<p>按 <big>← →</big> 方向键也可以换哦</p>
</div>
JS部分:
<script language="javascript">
last=document . getElementById("up").href;
next=document.getElementById("next").href;
function keyUp(e) {
if(navigator.appName == "Microsoft Internet Explorer"){
var keycode = event.keyCode;var realkey = String.fromCharCode(event.keyCode);
}else{
var keycode = e.which;var realkey = String.fromCharCode(e.which);
}
if(keycode==39){window.location.href=next;}
if(keycode==37){window.location.href=last;}
}
document.onkeyup = keyUp;
</script>
标签:
原文地址:http://www.cnblogs.com/yushouling/p/4756945.html