1.jQuery代码:
$(document).ready(function(){
var prevpage=$("#pre").attr("href");
var nextpage=$("#next").attr("href");
$("body").keydown(function(event){
if(event.keyCode==37 && prevpage!=undefined) location=prevpage;
if(event.keyCode==39 && nextpage!=undefined) location=nextpage;
});
});
2.Html代码:
记得要引入jQuery文件哦,好了这里就不多废话了,希望本文能够对大家学习jQuery有所帮助。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn