此方法影响用户体验,慎用!!
增加下面的JS代码可实现用户点击页面处弹出百度搜索进行刷展现,搜索
这个弹窗方式是久爱辅助模仿城通网盘的弹窗广告做的,使用js取、设cookie来判断是否弹窗
js代码如下:
<script> if (getCookie("baidu_tc")!="1"){ var array = new Array('AE博客','墨渊博客','AE墨渊'); 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>
转载请注明出处 AE博客|墨渊 » 网站首次点击自动弹出百度搜索代码教程
发表评论