根据分辨率调整div的height
<div id=divDd style= "overflow:auto; height:520px; width:100%; ">
<asp:DataGrid ID= "DataGrid1 " runat= "server ">
</asp:DataGrid>
</div>
<script language=javascript>
var x = screen.width;
var y = screen.height;
if((screen.width+ "* "+screen.height) == "1280*1024 ")
{
document.getElementById( "divDd ").style.height = 620px;
}
else
{
document.getElementById( "divDd ").style.height = 520px;
}
</script>
能不能这样做?错误提示缺少 "; "
------解决方案--------------------document.getElementById( "divDd ").style.height = "620px ";
------解决方案-------------------- <script language=javascript>
var x = screen.width;
var y = screen.height;
if((screen.width+ "* "+screen.height) == "1280*1024 ")
{
document.getElementById( "divDd ").style.height = "620px ";
}
else
{
document.getElementById( "divDd ").style.height = "520px ";
}
</script>
------解决方案--------------------document.getElementById( "divDd ").style.height = "520px ";
------解决方案-------------------- <div id=divDd style= "overflow:auto; height:520px; width:100%; ">
<asp:DataGrid ID= "DataGrid1 " runat= "server ">
</asp:DataGrid>
</div>
<script language=javascript>
var x = screen.width;
var y = screen.height;
if((screen.width+ "* "+screen.height) == "1280*1024 ")
{
document.getElementById( "divDd ").style.height = "620px ";
}
else
{
document.getElementById( "divDd ").style.height = "520px ";
}
</script>