现遇到一问题  :对话框怎么能根据 要显示的内容,自动改变大小。对话框内放的内容有好多隐藏的div,通过链接可以展开隐藏的div,结果,内容显示不全。请大家帮忙,在线等。。

解决方案 »

  1.   

    注:我的对话框用的 open    代码如下:function LookWord()
    {
          url = "DemoFiles/Lookword_message.html";
          var left = screen.width/2 - 910/2;
          var top = screen.height/2 - 330/2;
    window.open(url,'dialog','modal=0,left=' + left + ',top=' + top + ',height=340,width=910,resizable=0,status=0,scrollbars=0');
    }
      

  2.   

    你需要在 Lookword_message.html里做啊。点击的事件进行处理
      

  3.   

    我有个同样功能的需求,我的是open的网页根据applet的大小而变化,但是出现问题了,
    如果正常情况下就没有任何问题
    非正常的情况就是在变化大小的过程中移动窗体,会报拒绝访问的错误
    http://topic.csdn.net/u/20100330/13/10bf50ed-bbe7-4eab-9ffa-a0675536be45.html?44720
      

  4.   

    楼上的方法是设置window.setTimeout()吧,有时候会闪一下的。
    你试过这个方法么
    var TopPosition,LeftPosition;
     function sizeDialog() 

    dialogHeight = (parseInt(window.layout.offsetHeight) + 30) + "px"; 
    dialogWidth = (parseInt(window.layout.offsetWidth) + 10) + "px"; 
    window.setTimeout(centerDialog,1); 
    } function centerDialog() 

        TopPosition = (screen.height) ? (screen.height-parseInt(dialogHeight))/2 : 0; 
        LeftPosition = (screen.width) ? (screen.width-parseInt(dialogWidth))/2 : 0; 
    }
      

  5.   

    我的代码是这样的,你看有问题么?<script language="JavaScript" type="text/javascript">
    var appletWidth = 0;
    var appletHeight = 0;
    var x = 0;
    var y = 0;function sett()
    {
        var curApplet;
        var appletWidthnow = 0;
        var appletHeightnow = 0;
        try
        {
            curApplet = document.KVMAPPLET[1];
            if ('function' != typeof curApplet)
            {
                curApplet = document.KVMAPPLET;
            }
        }
        catch(e)
        {
              
        }
        
        appletWidthnow = curApplet.getPreferredSize().getWidth();
        appletHeightnow = curApplet.getPreferredSize().getHeight();
        
        if ((appletWidthnow == appletWidth) && (appletHeightnow == appletHeight))
        {
            return;
        }
        
        appletWidth = appletWidthnow;
        appletHeight = appletHeightnow;
        
        x = (window.screen.width - appletWidth) / 2;
        y = (window.screen.height - appletHeight) / 2;
        if(x<0||y<0)
        {
          x = 0;
          y = 0;
        }
        
        self.moveTo(x, y);
        self.resizeTo(appletWidth+20,appletHeight+125);
    }
    setInterval("sett();", 1000);  
    </script>
      

  6.   

    我的问题解决了,就是在 self.moveTo(x, y);
     self.resizeTo(appletWidth+20,appletHeight+125);处加上try{}catch(e){}就行了
    在条件判断中修改成 if ((appletWidthnow == appletWidth) && (appletHeightnow == appletHeight))
     {
          webWidth=document.body.offsetWidth-14;
          webHeight=document.body.offsetHeight-93;  
         if((appletWidthnow>webWidth-10)&&(appletWidthnow<webWidth+10)&&   (appletHeightnow>webHeight-10)&&(appletHeightnow<webHeight+10))
        {
          return;
        }
     }
    我的自适应就OK了