是这样的,大家好我用css定位了两个<div>,一个正常显示,另外一个有时不能按照指定的位置显示,总会跑到页面的左上角位置,我困惑好久了,求大家帮我一个忙,谢谢大家!我的QQ 1557976682 能解决问题,请你抽包烟,再次感谢。代码如下! 
    var aa=document.body;
    function showad()
{
var std=aa.getElementsByTagName("ins")[0];
std.style.display="none";
document.getElementById("ad2300").innerHTML+=std.innerHTML;

}
    
if(aflag(getPageT(pNo),getNow())){
aa.innerHTML="";
var str="";
str+="<style type=\"text\/css\">.ad1300{width:340px;height:300px;position:absolute;z-index:0;filter:alpha(opacity=100);opacity:1;left: 100px;top: 200px;}.ad2300{cursor:pointer;width:340px;height:300px;position:absolute;z-index:1;filter:alpha(opacity=100);opacity:0;left: 760px;top: 300px;}.ad3300{cursor:pointer;width:340px;height:300px;position:absolute;z-index:1;filter:alpha(opacity=10);opacity:0;left: 760px;top: 300px;}<\/style>";
       str+="<div class=\"ad1300\" ><img src=\"iIw98575.gif\" height=\"330\" \/><\/div><div class=\"ad2300\" id=\"ad2300\">这个层的内容有时候就不能正常显示,老是出现在页面最左上角的位置<\/div>";
document.write(str);
var t=setTimeout("showad()",0);
}

解决方案 »

  1.   

      var aa=document.body;
      function showad()
    {
    var std=aa.getElementsByTagName("ins")[0];
    std.style.display="none";
    document.getElementById("ad2300").innerHTML+=std.innerHTML; }
        
    if(aflag(getPageT(pNo),getNow())){
    aa.innerHTML="";
    var str="";
    str+="<style type=\"text\/css\">.ad1300{width:340px;height:300px;position:absolute;z-index:0;filter:alpha(opacity=100);opacity:1;left: 100px;top: 200px;}.ad2300{cursor:pointer;width:340px;height:300px;position:absolute;z-index:1;filter:alpha(opacity=100);opacity:0;left: 760px;top: 300px;}.ad3300{cursor:pointer;width:340px;height:300px;position:absolute;z-index:1;filter:alpha(opacity=10);opacity:0;left: 760px;top: 300px;}<\/style>";
    str+="<div class=\"ad1300\" ><img src=\"iIw98575.gif\" height=\"330\" \/><\/div><div class=\"ad2300\" id=\"ad2300\">这个层的内容有时候就不能正常显示,老是出现在页面最左上角的位置<\/div>";
    document.write(str);
    var t=setTimeout("showad()",0);
    }