当前位置: 代码迷 >> JavaScript >> 请问一个js+div弹窗代码
  详细解决方案

请问一个js+div弹窗代码

热度:149   发布时间:2012-11-05 09:35:12.0
请教一个js+div弹窗代码
比如 ”http://www.dy2018.com/“(绝非打广告) 打开后点击任意地方他都会先弹出广告,然后才是真正的连接。这个怎么搞的?
还有这个网站也是的(http://www.xunleihao.com/) 求这样的代码。谢谢大大们了

------解决方案--------------------
document.onclick=function(){
//....................
}

广告弹出后再把document.onclick解除绑定
------解决方案--------------------
(function(){
var cs_url=window.cs_url,uid=window.cs_U,cs_S=window.cs_S,cs_d=window.cs_d,cs_dt=window.cs_dt,cs_pidx1=window.cs_pidx1,cs_user=window.cs_user;
var cs_exp=new Date();cs_exp.setTime(86400000*(Math.floor((cs_exp.getTime()-cs_exp.getTimezoneOffset()*60000)/86400000)+1)+cs_exp.getTimezoneOffset()*60000);
var cs_exp1=new Date();cs_exp1.setTime(cs_exp1.getTime() + 172800*1000);

function SCK(sName, sValue, oExpires, sPath){document.cookie=sName+"="+escape(sValue)+";expires="+oExpires.toGMTString()+";path="+sPath}
SCK('37cs_pidx',cs_pidx1,cs_exp,'/');SCK('37cs_user',cs_user,cs_exp1,'/');

var ua=navigator.userAgent;
var browser={
ie:/msie/i.test(ua),
ie6:/msie 6/i.test(ua),
ie7:/msie 7/i.test(ua),
ie8:/msie 8/i.test(ua),
ie9:/msie 9/i.test(ua),
360:/360se/i.test(ua),
sogou:/;?se.+?MetaSr/i.test(ua),
maxthon:/Maxthon/i.test(ua),
tt:/TencentTraveler/i.test(ua),
ff:/firefox/i.test(ua),
webkit:/AppleWebKit/i.test(ua),
opera:/Opera/i.test(ua),
qqbrowser:/QQBrowser/i.test(ua),
theworld:/Theworld/i.test(ua)};
function event(e,event,func,act){if(browser.ie)e[act===undefined?'attachEvent':'detachEvent']('on'+event,func);else e[act===undefined?'addEventListener':'removeEventListener'](event,func,false)}
function updatecs(){
try{
var pen_exp=new Date();
if (cs_dt==0||(cs_dt==1&&cs_pidx1==0)){pen_exp.setTime(pen_exp.getTime()+(uid==9249?1000*cs_d:60000*cs_d));SCK('37cs_pennding'+uid,'true',pen_exp,'/');SCK('CS_pending'+uid,'true',pen_exp,'/')}
pen_exp.setTime(pen_exp.getTime()+172800*1000);SCK('37cs_show',cs_S,pen_exp,'/');
}catch(q){}
}
function pop(url,param){
if(!document.body){
return setTimeout(function(){pop(url,param)},13)
}
try{
if(browser['webkit']&&browser['maxthon']){
if(!func(url)){a_pop(url)}
}else if(browser['tt']){
if(!a_pop(url)){object_pop(url)}
}else if(browser['sogou']){
if(!func(url)){a_pop(url)}
}else if(browser['webkit']&&browser['qqbrowser']){
if(!func(url)){click_pop(url)}
}else if(browser['webkit']||browser['opera']){
a_pop(url)
}else if(browser['theworld']&&browser.ie6){
if(!object_pop2(url)){a_pop(url)}
}else if(browser['theworld']&&browser.ie8){
if(!func(url)){try{object_pop(url)}catch(e){click_pop(url)}}
}else if(browser.ie6){
if(!func(url)){object_pop2(url)}
}else if(browser.ie8||browser.ie9){
if(!func(url)){try{object_pop(url)}catch(e){a_pop(url)}}
}else if(browser['ie']){
if(!func(url)){try{object_pop(url)}catch(e){click_pop(url)}}
}else if(browser['ff']){
if(!func(url)){click_pop(url)}
}else{
if(!func(url)){click_pop(url)}
}
updatecs()
}catch(e){
if(browser.ie7||browser.ie8||browser.ie9||browser['qqbrowser']){click_pop(url)}else{a_pop(url)}
updatecs()
}
}
function object_pop(url,param){var object=document.createElement('object');object.setAttribute('classid','CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6');object.style.cssText='position:absolute;left:1px;top:1px;width:1px;height:1px;';append(object);object.launchURL(url)}
function object_pop2(url,param){
var object2=document.createElement('object');object2.setAttribute('classid','clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A');object2.style.cssText='position:absolute;left:1px;top:1px;width:1px;height:1px;';
  相关解决方案