- A+
所属分类:博客日记
适合搞促销的适合弹出广告页面,而且只弹一次,保留原来的页面,此代码非常的好用。
首先建立一个JS文件,放在网站的根目录,命名文123.js
- var wo_url = "https://www.mtboke.com/";
- var time = 1;
- if (document.cookie.indexOf("TC_666") < 0) {
- var d = new Date();
- d.setTime(d.getTime() + 999999 * time);
- var ew = null;
- try{
- ew = window.open(wo_url);
- } catch(e) {}
- if (ew != null) {
- document.cookie = "TC_666=1;expires=" + d.toGMTString() + ";path=/;";
- } else {
- window.onload = function () {
- document.body.onclick = function () {
- window.open(wo_url);
- document.cookie = "TC_666=1;expires=" + d.toGMTString() + ";path=/;";
- document.body.onclick = null;
- };
- };
- }
- }
然后在wordpress网页中加入此段代码
- <script charset="utf-8" src="……/123.js"></script>
大功告成,去测试一下吧。