代码名称:showModelessDialog弹出窗口代码,弹出窗口源码
代码特点:只兼容ie浏览器,可防止window.open弹出屏蔽
通用使用方法:将下面的代码复制到对应的广告位置,更改广告内容即可(具体细节请看代码里的说明)
HBcms系统使用方法:将下面代码复制到首页的某个自定义标记里(建议复制到默认的index_bottom_part标记里),更改广告内容,更新首页即可
showModelessDialog弹出窗口代码广告源码/代码:
<script language="javascript">
// 要弹出的网址
var hbcms_exitURL="http://www.hbcms.com/";
// 多长时间弹出一次(单位:小时)
// 如果要6分钟弹出一次,可设置为0.1
// 如果要每次访问都弹出,可设置为0
var hbcms_exp_hour=24;
// 弹出窗口宽度
var hbcms_pop_w = 750;
// 弹出窗口高度
var hbcms_pop_h = 600;
function setCookie(name, value, expire) {
window.document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}
function getCookie(Name) {
var search = Name + "=";
if (window.document.cookie.length > 0) { // if there are any cookies
offset = window.document.cookie.indexOf(search);
if (offset != -1) { // if cookie exists
offset += search.length; // set index of beginning of value
end = window.document.cookie.indexOf(";", offset) // set index of end of cookie value
if (end == -1)
end = window.document.cookie.length;
return unescape(window.document.cookie.substring(offset, end));
}
}
return null;
}
//本代码由宏博cms网站内容管理系统(http://www.hbcms.com/)整理修改
function register(name) {
var today = new Date();
var expires = new Date();
expires.setTime(today.getTime() + 1000*60*60*hbcms_exp_hour);
setCookie("hbcms_pop_c", name, expires);
}
function openWin() {
var c = getCookie("hbcms_pop_c");
if (c != null) {
return;
}
register("redoo");
var featureStr="";
featureStr="scroll:1;status:1;help:1;resizable:1;dialogWidth:"+hbcms_pop_w+"px; dialogHeight:"+hbcms_pop_h+"px;dialogLeft:0;dialogTop:0;toolbar=yes, menubar=yes, resizable=yes,location=yes,status=yes";
//featureStr="height=760, width=800, top=0, left=0, toolbar=yes, menubar=yes,resizable=yes,location=yes,status=yes";
self.focus();
//var ExitWindow = window.open(exitURL,"redoo", featureStr);
var ExitWindow = window.showModelessDialog(hbcms_exitURL,"redoo", featureStr);
ExitWindow.focus();
}
openWin();
window.focus()
</script>