当前位置:首页- Js、css代码 - 网站首次打开点击任意地方弹出百度搜索

网站首次打开点击任意地方弹出百度搜索

2017-10-7 作者:大资源外挂网  分类: Js、css代码    阅读:6922

emlog网站程序的话吧下面的JS代码放到header头部引用即可

<script>
if (getCookie("baidu_tc")!="1"){
	var array = new Array('小超资源网','小超','小超教学网');
	document.write('<a href="http://www.baidu.com/s?ie=UTF-8&wd=' + encodeURIComponent(array[Math.floor(Math.random()*(array.length))]) + '" target="_blank" style="position: absolute; z-index: 9999999999; opacity: 0.1;top: 0px; left: 0px; width: 100%; height: '+document.body.offsetHeight+'px; background-color: rgb(255, 255, 255);" id="baidu_tc" onclick="baidu_tc();"></a>');
	function baidu_tc(){
		document.getElementById("baidu_tc").style.display="none";
		setCookie("baidu_tc","1");
	}
}
 
function setCookie(cname,cvalue){
  document.cookie = cname + "=" + cvalue + "; path=/";
}
 
function getCookie(cname){
  var name = cname + "=";
  var ca = document.cookie.split(';');
  for(var i=0; i<ca.length; i++) {
    var c = ca[i].trim();
    if (c.indexOf(name)==0){
		return c.substring(name.length,c.length);
	}
  }
  return "";
}
</script>