js 求助 高手来~~清囊相送~
写了个广告脚本测试,IE7、8下显示不正常,会加载两次。火狐,搜狗等没有事。代码如下:
- HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <HEAD><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><TITLE> New Document </TITLE></HEAD><BODY><script type="text/javascript" charset="utf-8">function csAD(){ var csad_vars = []; var scan_postion = function () { csad_vars = csad_vars.concat([[1489,1020,'','',980,90,'','','_blank','','','','',7030,0,0,0,'yes','yes','yes','','','','',980,90,'',0,0,'','','no','yes','<script src=\"test.js\"><\/script>','code',0,'','_blank','','','','','','','','']]); show_match_ad(csad_vars); }; var show_match_ad = function(the_ads){ the_ad = the_ads[0]; html = the_ad[33]; document.write(html); } var init = function(){ scan_postion(); } if (Boolean(csad_vars)) { if (document.all) window.attachEvent("onload", function(){init();}); else window.addEventListener("load", function(){init();}, false); }}new csAD();</script></BODY></html>js代码
- JScript code
var cs_adsp_param = new Array();cs_adsp_param['ad_show_time'] = 1000*5;cs_adsp_param['b_width'] = 960;cs_adsp_param['b_height'] = 320;cs_adsp_param['b_ad_resource'] = 'http://images.sohu.com/bill/s2012/MKT/Yule/Ju/0218-countrystory/450105-mkt3.swf';cs_adsp_param['b_id'] = 'cs_ad_sp_main';cs_adsp_param['s_width'] = 210;cs_adsp_param['s_height'] = 100;cs_adsp_param['s_ad_resource'] = 'http://images.sohu.com/bill/s2012/MKT/Yule/Ju/0218-countrystory/450105-mkt3.swf';cs_adsp_param['s_id'] = 'cs_ad_sp_deputy';cs_adsp_param['left'] = 15;var cs_as_sto = setInterval('cs_adsp_hide()', cs_adsp_param['ad_show_time']);function cs_adsp_show(){ document.getElementById(cs_adsp_param['s_id']).style.display = ''; document.getElementById(cs_adsp_param['b_id']).style.display = 'none'; cs_as_sto;}function cs_adsp_hide(){ document.getElementById(cs_adsp_param['s_id']).style.display = 'none'; document.getElementById(cs_adsp_param['b_id']).style.display = '';}function cs_adsp_hide2(){ clearInterval(cs_as_sto); document.getElementById(cs_adsp_param['b_id']).style.display = 'none';}var Ie_ver=navigator["appVersion"].substr(22,1);if(Ie_ver == 6){ var cs_ad_sp_style = "POSITION: absolute;TOP: expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop+(documentElement.clientHeight-this.clientHeight) - 300:document.body.scrollTop+(document.body.clientHeight-this.clientHeight) - 300);"; var cs_ad_sp_style2 = "POSITION: absolute;TOP: expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop+(documentElement.clientHeight-this.clientHeight)-1:document.body.scrollTop+(document.body.clientHeight-this.clientHeight) - 1);"; var cs_ad_sp_iframe = '<iframe scrolling="no" frameborder="0" src="javascript:false" style="position:absolute; top:0; left:0; width:100%; height:100%; z-index:-1;filter:Alpha(Opacity=0);"></iframe>';}else{ var cs_ad_sp_style = 'POSITION: fixed;'; var cs_ad_sp_style2 = 'POSITION: fixed;'; var cs_ad_sp_iframe = '';}document.write('<div style="display:none;height: 300px; border: 1px solid #000; bottom:0;right:0; width: '+cs_adsp_param['s_width']+'px; height:120px; '+cs_ad_sp_style2+'" id="'+cs_adsp_param['b_id']+'">'+cs_ad_sp_iframe+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+cs_adsp_param['s_width']+'" height="'+cs_adsp_param['s_height']+'"><param name="movie" value="'+cs_adsp_param['s_ad_resource']+'" /><param value="false" name="menu"/><param value="opaque" name="wmode"/><param name="quality" value="high" /><param value="false" name="menu"/><param value="opaque" name="wmode"/><param name="SCALE" value="exactfit" /><embed src="'+cs_adsp_param['s_ad_resource']+'" width="'+cs_adsp_param['s_width']+'" height="'+cs_adsp_param['s_height']+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="exactfit"></embed></object><div style="height:20px;width:'+cs_adsp_param['s_width']+'px;"><span style="cursor:pointer;float:left;margin-left:20px;" onclick="cs_adsp_show()">重播</span><span style="cursor:pointer;float:right;margin-right:20px;" onclick="cs_adsp_hide2()">关闭</span></div></div><div id="'+cs_adsp_param['s_id']+'" style="margin:0 auto;z-index:100; border:1px solid #300;height:'+(cs_adsp_param['b_height']+20).tostring +'px; width:'+cs_adsp_param['b_width']+'px;left:'+cs_adsp_param['left']+'%; top:10%; background:#f3f3f3; '+cs_ad_sp_style+'">'+cs_ad_sp_iframe+'<span onclick="cs_adsp_hide()" style="float:right;cursor:pointer">[X]</span><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+cs_adsp_param['b_width']+'" height="'+cs_adsp_param['b_height']+'"><param name="movie" value="'+cs_adsp_param['b_ad_resource']+'" /><param value="false" name="menu"/><param value="opaque" name="wmode"/><param name="quality" value="high" /><param value="false" name="menu"/><param value="opaque" name="wmode"/><param name="SCALE" value="exactfit" /><embed src="'+cs_adsp_param['b_ad_resource']+'" width="'+cs_adsp_param['b_width']+'" height="'+cs_adsp_param['b_height']+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="exactfit"></embed></object></div>');
[解决办法]
好问题,帮顶