Home  >  Article  >  Web Front-end  >  鼠标点击和键盘点击自动跳转页面_html/css_WEB-ITnose

鼠标点击和键盘点击自动跳转页面_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:57:221862browse

$(function(){
var i = 0;
document.onmousedown=function(event){ 
  if(i==1){
window.open('http://www.njxblog.com');
}
//setTimeout(function (){window.open('http://www.njxblog.com')},2000);  //定时不太好使,会被浏览器当成广告的
i++;
  };
var j = 0;
document.onkeydown=function(event){ 
  if(j==1){
window.open('http://www.njxblog.com');
}
//setTimeout(function (){window.open('http://www.njxblog.com')},2000);   //定时不太好使,会被浏览器当成广告的
j++;
  };

});

(转自:小池编程的博客)

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