2012-01-23 113 views
1

我的桌子的高度调整100%我有一个表,边框宽度为1如何在所有屏幕分辨率

我如何可以调整所有的屏幕分辨率的高度为100%? 或者使用jQuery,我该如何动态改变桌面高度?

我在Web应用程序中新的

请帮助?...

拉杰什

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
<head> 
<title></title> 
</head> 

<script src="./Scripts/jquery-1.4.1.js" type="text/javascript"> 
jQuery(document).ready(function() { 
    jQuery('#SprImg').attr("height", jQuery(window).height()); 
}); 
</script> 

<body> 

<table id="Table1" cellpadding="0" cellspacing="0" runat ="server" width="100%" border="0" align="left"> 
    <tr> 
      <td id="LeftPane" align="left" valign="top" width="175" runat="server" ></td> 
      <td id="RightPane" align="left" width="*.*" runat="server" valign="top"> 
      <img id="SprImg" src="./Image/login.gif" alt="" /> 

      </td> 
    </tr> 
</table> 

+0

你可以显示你正在使用和描述的代码(也许甚至用嘲弄的屏幕截图)你试图实现什么?这个问题并不清楚。 – David

+0

有什么想法?...... –

回答

5

您可以使用一个技巧,使这一点。将img放在您的table的某个位置,该位置从上到下需要一整列,这是不可见的。然后载入,将此图像高度更改为文档高度,然后强制表格占据此高度。

jQuery(document).ready(function() { 
    jQuery('#SprImg').attr("height", jQuery(window).height()); 
}); 

和图像,即1x1像素透明GIF

<img id="SprImg" src="/images/spacer.gif" width="1" height="1" alt="" /> 

将它放在从上到下的列内的某个位置。现在,您可以绑定窗口更改大小,以便在用户调整浏览器大小的情况下不断将图像高度更改为窗口高度。

整页。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 

    <script> 
    jQuery(document).ready(function() { 
     jQuery('#SprImg').attr("height", jQuery(window).height()); 
    }); 
    </script> 

</head> 
<body> 

<table id="Table1" cellpadding="0" cellspacing="0" runat ="server" width="100%" border="1" align="left"> 
    <tr>    
     <td id="LeftPane" align="left" valign="top" width="175" runat="server"> 
      test text 
     </td> 
     <td id="RightPane" align="left" width="*.*" runat="server" valign="top"> 
      <img id="SprImg" src="/img/ui/spacer.gif" width="1" height="1" alt="" /> 
     </td> 
    </tr> 
</table> 

</body> 
</html> 
+0

谢谢你的回应.. –

+0

@RajeshAbraham不客气,欢迎来到stackoverflow。在这里,你不需要寻求帮助,或者要求“任何想法”幽默地说很多谢谢。感谢您的投票并接受正确的答案。如果他们知道的话,他们会帮助他们,如果你提出了一个很好的问题。 :) – Aristos

+0

嗨Aristos。它不会增加图像。我发布了代码。你能检查它吗? –