<form> 
<div style="width:100%" >    
<div id="head">
<table style="width:100%;" border="0px" cellpadding="0px" cellspacing="0" align="center">
<tr>
<td style="width:29.2%;height:91px;background: url(images/1.jpg) repeat-x;"></td>
<td style="width:40.4%;height:91px;background: url(images/2.jpg) repeat-x;"><h1>系</h1></TD>
<td style="width:20.4%;height:91px;background: url(images/4.jpg) repeat-x;"></td>
<td style="width:10%;height:91px;background: url(images/3.jpg) repeat-x;"></td>
</tr>
</table>
</div>
</div>
</form>
我的分辨率是1024*768显示没有问题,但在别人宽屏上时,右边出现很大白空隙,怎么让div随分辨率变化而变化。谢谢 

解决方案 »

  1.   

    具体怎麽用,网上找了些,说body.clientWidth不是left属性之类,能给点代码么我试试么
      

  2.   

    try<td style="width:10%;height:91px;background: url(images/3.jpg) repeat-x;"></td> ==>
    <td style="width:auto;height:91px;background: url(images/3.jpg) repeat-x;"></td>
      

  3.   

    <div id="head">  这个的 width 是多少?  table 的width 你设了100%,是相对于它的上层容器---- <div id="head">来说的,而<div id="head">如果没有设置width 的话,很容易出现你说的问题的  
     
      

  4.   

    大致的js代码:
    给出分辨率小于800和大于800设置div1的代码,其中x1,y1,x2,y2自己定义!!
         function SetHeight() {
           var hei = window.screen.height;
           //        var hei1 = document.body.clientHeight;
           if (hei <= 800) {
             document.getElementById("div1").style.height = x1;
             document.getElementById("div1").style.height = y1;
           }
           else if (hei > 800) {
             document.getElementById("div1").style.height = x2;
             document.getElementById("div1").style.height = y2;
           }
         }