如何获得手机屏幕的宽度和高度 [英] How to get Mobile Screen width and Height
本文介绍了如何获得手机屏幕的宽度和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当任何移动设备访问我的aspx页面时,我想获取它的宽度"和高度".
任何人都可以提供代码吗?......
Nilesh
Hi,
When any mobile visit my aspx page, I want to fetch it Width and Height.
Can anyone Pls provide a code.......
Nilesh
推荐答案
JavaScript支持screen.width和screen.height.当然,您需要渲染页面并进行回发才能首先获得这些值.
代码只是将这些值存储在一个隐藏字段中以进行回发或进行AJAX调用.当然,如果您正在编写网站,那么您知道该怎么做吗?
Javascript supports screen.width and screen.height. Of course, you need to render a page and have a postback to get those values at first.
The code is just going to take those values and store them in a hidden field to grab on postback, or do an AJAX call. Surely if you''re writing a website, you know how to do that ?
这篇关于如何获得手机屏幕的宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文