javascript onkeydown实现键盘快捷键控制页面
作者:
javascript onkeydown实现键盘快捷键控制页面
IE only的鼠标左右键控制上一页下一页
<script type="text/javascript">
<!--
var preview_page = "14671.html";
var next_page = "14675.html";
var index_page = "index.html";
var article_id = "305";
var chapter_id = "14674";
function jumpPage() {
if (event.keyCode==37) location=preview_page;
if (event.keyCode==39) location=next_page;
if (event.keyCode==13) location=index_page;
}
document.onkeydown=jumpPage;
<:/script>
<script>
//qidian
prevpage='1006900,20124741.aspx';
nextpage='1006900,20124757.aspx';
bookpage='/Book/1006900.aspx'
var prevpage;
var nextpage;
var bookpage;
function pageEvent(event)
{
event = event ? event : (window.event ? window.event :
null);
if (event.keyCode==13)
{
location=bookpage
return false;
}
if (event.keyCode==37) location=prevpage
if (event.keyCode==39) location=nextpage
}
document.onkeydown=pageEvent;
-->
</script>
来自经典的IE和firefox都兼容的
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
<script type="text/javascript">
<!--
var preview_page = "14671.html";
var next_page = "14675.html";
var index_page = "index.html";
var article_id = "305";
var chapter_id = "14674";
function jumpPage() {
if (event.keyCode==37) location=preview_page;
if (event.keyCode==39) location=next_page;
if (event.keyCode==13) location=index_page;
}
document.onkeydown=jumpPage;
<:/script>
<script>
//qidian
prevpage='1006900,20124741.aspx';
nextpage='1006900,20124757.aspx';
bookpage='/Book/1006900.aspx'
var prevpage;
var nextpage;
var bookpage;
function pageEvent(event)
{
event = event ? event : (window.event ? window.event :
null);
if (event.keyCode==13)
{
location=bookpage
return false;
}
if (event.keyCode==37) location=prevpage
if (event.keyCode==39) location=nextpage
}
document.onkeydown=pageEvent;
-->
</script>
来自经典的IE和firefox都兼容的
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]