Home  >  Article  >  Web Front-end  >  javascript onkeydown实现键盘快捷键控制页面_javascript技巧

javascript onkeydown实现键盘快捷键控制页面_javascript技巧

WBOY
WBOYOriginal
2016-05-16 19:05:111231browse

IE only的鼠标左右键控制上一页下一页
<script> <BR><!-- <BR>var preview_page = "14671.html"; <BR>var next_page = "14675.html"; <BR>var index_page = "index.html"; <BR>var article_id = "305"; <BR>var chapter_id = "14674"; <br><br>function jumpPage() { <BR> if (event.keyCode==37) location=preview_page; <BR> if (event.keyCode==39) location=next_page; <BR> if (event.keyCode==13) location=index_page; <BR>} <BR>document.onkeydown=jumpPage; <BR><:/script><br><br><script><BR>//qidian <BR>prevpage='1006900,20124741.aspx'; <BR>nextpage='1006900,20124757.aspx'; <BR>bookpage='/Book/1006900.aspx' <BR>var prevpage; <BR>var nextpage; <BR>var bookpage; <BR>function pageEvent(event) <BR>{ <BR> event = event ? event : (window.event ? window.event : <BR>null); <BR> if (event.keyCode==13) <BR> { <BR> location=bookpage <BR> return false; <BR> } <br><br> if (event.keyCode==37) location=prevpage <br><br> if (event.keyCode==39) location=nextpage <BR>} <BR>document.onkeydown=pageEvent; <BR>--> <BR></script>
来自经典的IE和firefox都兼容的


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
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