先判断浏览器大小,再用document.write("...width="+newwidth+" height="+newheight)写出!!

解决方案 »

  1.   

    to net_lover(孟子E章):如果用户用鼠标拉动调整浏览器的大小,我想ActiveForm对象按浏览器的大小等比缩放,不知该怎么办?
      

  2.   

    计算出窗口和控件的百分比,在 onresize里进行计算!!
      

  3.   

    你好,net_lover(孟子E章),能给我发个例子吗?
    [email protected]
      

  4.   

    <body id=body1 onresize="location.reload()">
    <!--  下面以一个图片为例子,其他控件类似,假设图象在800宽的页面上宽和高为480和754,具有缩放功能的例子如下 -->
    <script>
    var imgratio=480/754;
    var ratio=800/480
    var newwidth=body1.clientWidth 
    var newimg=Math.round(newwidth/ratio)
    var newimgheight=Math.round(newimg/imgratio)
    document.write("<img src='http://lucky.myrice.com/back.jpg' width="+newimg+" height="+newimgheight+">")
    </script>