js监听鼠标点击(onmousedown)和键盘点击(onkeydown)事件并自动跳转页面,在学习的朋友可以参考下
$(function(){var i = 0;document.onmousedown=function(event){ if(i==1){window.open('http://www.njxblog.com');}//setTimeout(function (){window.open('//www.VeVB.COm')},2000); //定时不太好使,会被浏览器当成广告的i++; };var j = 0;document.onkeydown=function(event){ if(j==1){window.open('http://www.njxblog.com');}//setTimeout(function (){window.open('//www.VeVB.COm')},2000); //定时不太好使,会被浏览器当成广告的j++; };});
PS:这里再为大家推荐一款关于JS事件的在线查询工具,归纳总结了JS常用的事件类型与函数功能:
javascript事件与功能说明大全:
新闻热点
疑难解答