打开网站后自动弹出新网页的代码分享

2016-7-4 / 6 评论 / 13937 阅读

如:在浏览并关闭www.shuyong.net后,自动弹出www.baidu.com这个页面。具体代码如下

<script type="text/javascript">window.onunload = function(){window.open("http://www.baidu.com");}</script>

以上不管是打开或者关闭网站都会弹出新的页面,把代码放入<head></head>之间即可



实现24小时之内只弹出一次窗口代码如下

<script language="javascript">
function setCookie(www_shuyong_net, value, expire){window.document.cookie = www_shuyong_net + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));}
function getCookie(www_shuyong_net){var search = www_shuyong_net + "=";if(window.document.cookie.length > 0){offset = window.document.cookie.indexOf(search);if(offset != -1){offset += search.length;end = window.document.cookie.indexOf(";", offset)  if(end == -1)
end = window.document.cookie.length;return unescape(window.document.cookie.substring(offset, end));}}return null;}
function register(www_shuyong_net){var today = new Date();var expires = new Date();
expires.setTime(today.getTime() + 1000*60*60*24);//时间格式:1000*60*60*24代表24小时
setCookie("shuyong_net", www_shuyong_net, expires);}
var exitURL="http://www.shuyong.net/";//这个地方放置你的HTML地址
function openWin(){var c = getCookie("shuyong_net");if(c != null){return;}register("shuyong_net");var featureStr="''";
featureStr="";//这里是设置你上面的HTML弹出的高度和宽度的
self.focus();var ExitWindow = window.open(exitURL,'', featureStr);ExitWindow.focus();}
setTimeout("openWin()",3000);//3秒后弹出
window.focus();
</script>

评论一下?

OωO
取消
    1. 头像
      luozhiyuan
      第6楼
      2017最新方案,外部链接可以直接WAP跳转到微信中打开链接,支持支付接入,可携带支付参数完成付款,支持安卓和IOS,方法我已经系统化,直接给普通用户提供API接口,需要的可以直接找我拿 QQ77408026
      微信疑难工具http://www.api-export.com
      回复
    1. 头像
      小晨子技术网
      第5楼
      支持!小晨子技术网:http://www.xiaochenzi.com
      回复
    1. 头像
      123
      第4楼
      看看技术
      回复
    1. 头像
      大美丽
      地板
      看看技术
      回复
    1. 头像
      火昱
      板凳
      看看结果
      回复
    1. 头像
      春熙路
      沙发
      技术代码
      回复