这段代码是从哪里开始执行的。
有可能是其他地方的javascript语法错误,编译不过,这段就不执行

解决方案 »

  1.   

    其它没有代码,是.JS 文件
    且IE没有提示错误
      

  2.   

    是不执行还是高度没有自动调整?
    你可以在iframeAutoFit函数里alert()一下,看看是不是执行了
      

  3.   

    这也加一句
    if(document.attachEvent)
    {
      alert("1")
      window.attachEvent("onload",  iframeAutoFit);
    }
    else
    {
       alert("2")
       window.addEventListener('load',  iframeAutoFit,  false);
    }
      

  4.   

    看看window.attachEvent("onload",  iframeAutoFit)的返回值究竟绑定了没?
      

  5.   

    改成这样试试:
    if(document.body.attachEvent){
          alert("ok");
          flag = document.body.attachEvent("onload",iframeAutoFit);
          alert("flag="+flag);
    }
    else{
          document.bdoy.addEventListener('load',  iframeAutoFit,  false);
    }
      

  6.   

    if(!window.attachEvent && window.addEventListener)
    {
      Window.prototype.attachEvent = HTMLDocument.prototype.attachEvent=
      HTMLElement.prototype.attachEvent=function(en, func, cancelBubble)
      {
        var cb = cancelBubble ? true : false;
        this.addEventListener(en.toLowerCase().substr(2), func, cb);
      };
    }window.attachEvent("onload", iframeAutoFit);
      

  7.   

    /*
    [作用]:iframe自动设置高
    */
    var iframeids=["LeftIframe","RightIframe"];
    var iframehide="yes"
    function dyniframesize() 
    {
        var dyniframe=new Array()
        for (i=0; i<iframeids.length; i++)
        {
    if (document.getElementById)
    {
    dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
    if (dyniframe[i] && !window.opera)
    {
    dyniframe[i].style.display="block"
    if (dyniframe[i].document && dyniframe[i].document.body.scrollHeight) 
    dyniframe[i].height = dyniframe[i].document.body.scrollHeight-265;
    }
    } if ((document.all || document.getElementById) && iframehide=="no")
    {
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
    }
    }
    }if (window.addEventListener)
    {
    window.addEventListener("load", dyniframesize, false)
    }
    else if (window.attachEvent)
    {
    window.attachEvent("onload", dyniframesize)
    }
    else
    {
    window.onload=dyniframesize
    }