document.onkeydown=function(b){
b=(b)?b:window.event;
var page_index = "2"; //当前页
var page_num = "4"; //页面总数
if(""==page_index)return;
if(b.keyCode=="37"){
if(page_index > 1){
window.location.href="Left Arrow - url";
}
}else if(b.keyCode=="39"){
if(parseInt(page_index) < parseInt(page_num)){
window.location.href="Right Arrow - url";
}
}
}
来自http://mobile.zol.com.cn 源码
转载请注明:来自ueaner.iteye.com,本文地址:http://ueaner.iteye.com/blog/1541643
本文介绍了一段用于键盘导航网页翻页的JavaScript脚本,该脚本通过监听键盘按键事件来判断用户是否按下左箭头或右箭头,并据此进行页面跳转。适用于具有多页浏览功能的网站。
802

被折叠的 条评论
为什么被折叠?



