日期:2014-05-16  浏览次数:20471 次

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