如何在所有屏幕分辨率下调整我的桌面高度100%

Raj*_*ham 1 asp.net

我有一张桌子,边框宽度是1.

如何在所有屏幕分辨率下将高度调整为100%?或者使用jQuery如何动态更改表高度?

我是网络应用程序的新手

请帮忙?...

拉杰什

<!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>
Run Code Online (Sandbox Code Playgroud)

Ari*_*tos 5

你可以使用一个技巧来做到这一点.img在你的位置放置一个table从上到下的完整列,这是不可见的.然后上载您将此图像高度更改为文档高度,并强制表格采取此高度.

jQuery(document).ready(function() {
    jQuery('#SprImg').attr("height", jQuery(window).height());
});
Run Code Online (Sandbox Code Playgroud)

和图像,即1x1像素透明gif.

 <img id="SprImg" src="/images/spacer.gif" width="1" height="1" alt="" />
Run Code Online (Sandbox Code Playgroud)

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

整页.

<!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>
Run Code Online (Sandbox Code Playgroud)