日期:2014-05-18 浏览次数:20391 次
<script src="js/jquery-1.5.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $.post("CacheDemo.aspx", { "strWidth": window.screen.width,"strHeight":window.screen.height }, function(data, status) { if (status == "success") { } }); }); </script>
------解决方案--------------------
js:
<script language="javascript" type="text/javascript">
var w=screen.width;
var h=screen.height;
//alert( "当前显示器分辨率 "+w+ "* "+h);
document.getElementById("w").value = w;
document.getElementById("h").value = h;
</script>
页面:
<asp:hiddenfield id="w" runat="server" value=""></asp:hiddenfield>
<asp:hiddenfield id="h" runat="server" value=""></asp:hiddenfield>
page_load中,
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = "height = " + h.value;
TextBox2.Text = "width = " + w.value;
}