---
title: "左右键“← →”实现快速翻页"
author: "Ueaner"
date: "2012-05-26T02:14:14Z"
tags: ["JS"]
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2012-05-26T02:15:08Z"
id: 1541643
url: "https://ueaner.iteye.com/blog/1541643"
---

```
             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](http://ueaner.iteye.com/blog/1541643)