html中 如何获取屏幕宽度??
2013-08-28
展开全部
把以下这段代码放到<head></head>之间或<body></body>之间预览即可看到数据
<script language="javascript" type="text/javascript">
/*将获取的值存到变量里*/
width_screen=screen.width;
height_screen=screen.height;
availWidth_screen=screen.availWidth;
availHeight_screen=screen.availHeight;
colorDepth_screen=screen.colorDepth;
/*end*/
/*输出值*/
document.write("你的屏幕宽为:"+width_screen+"
你的屏幕高为:"+height_screen+"
你的屏幕可用宽为:"+availWidth_screen+"
你的屏幕可用高为:"+availHeight_screen+"
你的颜色设置所有为数为:"+colorDepth_screen);
/*end*/
</script>
<script language="javascript" type="text/javascript">
/*将获取的值存到变量里*/
width_screen=screen.width;
height_screen=screen.height;
availWidth_screen=screen.availWidth;
availHeight_screen=screen.availHeight;
colorDepth_screen=screen.colorDepth;
/*end*/
/*输出值*/
document.write("你的屏幕宽为:"+width_screen+"
你的屏幕高为:"+height_screen+"
你的屏幕可用宽为:"+availWidth_screen+"
你的屏幕可用高为:"+availHeight_screen+"
你的颜色设置所有为数为:"+colorDepth_screen);
/*end*/
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询