Heim >Web-Frontend >js-Tutorial >javascript onkeydown实现键盘快捷键控制页面_javascript技巧
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都兼容的