只能用客户端脚本来进行判断
好像是
window对像后面有个availwidth属性,你试试
好像是
window对像后面有个availwidth属性,你试试
解决方案 »
- JS:在本地运行可以。放到空间就不运行了
- 请教一个存储过程
- dropdownlist的onchange和label赋值的问题
- 更新数据丢失数据的问题
- 关于刷新的问题
- petshop 里面的 PetShop.Components; 是从哪里来的?能看到Components 的代码吗?
- 关于在带框架网页中https页面,急!!!
- 怎样在DataGrid控件里使用DropDownList控件动态的获得数据库中的值?
- 怎么有WEB FORM里生成弹出的水晶报表?
- 在线急急的问:DataGrid得模板中嵌入RadioButton组后,如何取出RadioButton组的选择信息? 最后的大骨头了,大家一定要帮忙
- 一个棘手的问题,关于xml文件的安全性问题
- 将图片传入sql数据库时碰到的问题
<html>
<head>
<title>GetClientScreen</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language=javascript>
alert(window.screen.width + "X" +window.screen.height )
alert(window.screen.availWidth + "X" +window.screen.availHeight )
</script>
</head>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
</form>
</body>
</html>运行一下就知道啦!
如果你只是要设定单个label的字体!
你可以直接在客户端脚本里面判断了分辨率后设定label的字体的大小(当然也是在脚本里做)
1、首先在页面上建两个html控件:
<INPUT id="Text1" style="BORDER-RIGHT: #9999cc thin solid; BORDER-TOP: #9999cc thin solid; Z-INDEX: 121; LEFT: 376px; BORDER-LEFT: #9999cc thin solid; WIDTH: 82px; BORDER-BOTTOM: #9999cc thin solid; POSITION: absolute; TOP: 14px; HEIGHT: 21px" type="text" size="8" value="1" name="Text1" runat="server">
<INPUT id="Text2" style="BORDER-RIGHT: #9999cc thin solid; BORDER-TOP: #9999cc thin solid; Z-INDEX: 121; LEFT: 376px; BORDER-LEFT: #9999cc thin solid; WIDTH: 82px; BORDER-BOTTOM: #9999cc thin solid; POSITION: absolute; TOP: 14px; HEIGHT: 21px" type="text" size="8" value="1" name="Text2" runat="server">其中,runat="server"是在设计器中右击选作为服务器控件运行。用来存放分辩率。
2、在客户端脚本中:
window.document.all.item("Text1").value=screen.width;
window.document.all.item("Text2").value=screen.height;
这样,分辨率就存放在控件中了。
注意:此脚本应放在aspx代码的底部,即</body>上端,否则在页面初始加载时因这两个控件还未生成,会报错。
3、在服务器端代码需要用到的地方:
string pagewidth=Request.Form["Text1"].ToString();
string pageheight=Request.Form['Text2"].ToString();
4、将这两个控件的z-index设为最小,如1,隐藏在其它控件底下,以免破坏页面。
5、当然,分辨率也可以存放在其它类型的控件里,但上述控件是我已试验成功的。
挺麻烦的吧,没办法。我现在就是这样做的,不过是用来隨着分辨率大小来调整image大小的。