左右键“← →”实现快速翻页

             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

 

 

你可能感兴趣的:(js)