function a(){
"屏幕寬高為:"+screen.width+"*"+screen.height;
}
其它:
網頁可見區域寬:document.body.clientWidth
網頁可見區域高:document.body.clientHeight
網頁可見區域寬:document.body.offsetWidth (包括邊線的寬)
網頁可見區域高:document.body.offsetHeight (包括邊線的寬)
網頁正文全文寬:document.body.scrollWidth
網頁正文全文高:document.body.scrollHeight
網頁被捲去的高:document.body.scrollTop
網頁被捲去的左:document.body.scrollLeft
網頁正文部分上:window.screenTop
網頁正文部分左:window.screenLeft
屏幕解析度的高:window.screen.height
屏幕解析度的寬:window.screen.width
屏幕可用工作區高度:window.screen.availHeight
屏幕可用工作區寬度:window.screen.availWidth
HTML精確定位:scrollLeft,scrollWidth,clientWidth,offsetWidth
scrollHeight: 獲取對象的滾動高度。
scrollLeft:設置或獲取位於對象左邊界和窗口中目前可見內容的最左端之間的距離
scrollTop:設置或獲取位於對象最頂端和窗口中可見內容的最頂端之間的距離
scrollWidth:獲取對象的滾動寬度
offsetHeight:獲取對象相對於版面或由父坐標 offsetParent 屬性指定的父坐標的高度
offsetLeft:獲取對象相對於版面或由 offsetParent 屬性指定的父坐標的計算左側位置
offsetTop:獲取對象相對於版面或由 offsetTop 屬性指定的父坐標的計算頂端位置
event.clientX 相對文檔的水平座標
event.clientY 相對文檔的垂直座標
event.offsetX 相對容器的水平坐標
event.offsetY 相對容器的垂直坐標
document.documentElement.scrollTop 垂直方向滾動的值
event.clientX+document.documentElement.scrollTop 相對文檔的水平座標+垂直方向滾動的量
2. 求人幫我寫一個JS頁面獲取屏幕尺寸大小
把參數說一下。幫你分析
3. javascript怎麼獲取屏幕大小
一個是javascript的window.screen,還有document.body對象。
下面舉個實際例子來說明:
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>標題一</title>
</head>
<body>
<script>
varwidth1=window.screen.width;
varheight1=window.screen.height;
varwidth2=window.screen.availWidth;
varheight2=window.screen.availHeight;
varwidth3=document.body.clientWidth||document.documentElement.clientWidth;
varheight3=document.body.clientHeight||document.documentElement.clientHeight;
varwidth4=document.body.offsetWidth||document.documentElement.offsetWidth;
varheight4=document.documentElement.offsetHeight;
document.write("屏幕的寬度高度:"+width1+"*"+height1+"<br>除去了系統狀態欄的寬度和高度:"+width2+"*"+height2+"<br>出去了滾動條,系統狀態欄,瀏覽器菜單欄的頁面高度和寬度:"+width3+"*"+height3+"<br>")
</script>
</body>
</html>
4. 如何用js判斷屏幕大小
screen.width屏幕寬度
screen.height屏幕高度
此處獲取的是屏幕的相關參數,與瀏覽器窗口大小無關
5. HTML怎樣獲取屏幕尺寸
<html>
<script>
function a(){
document.write(
"屏幕解析度為:"+screen.width+"*"+screen.height //最好是window.screen
+"<br />"+
"屏幕可用大小:"+screen.availWidth+"*"+screen.availHeight
+"<br />"+
"網頁可見區域寬:"+document.body.clientWidth
+"<br />"+
"網頁可見區域高:"+document.body.clientHeight
+"<br />"+
"網頁可見區域寬(包括邊線的寬):"+document.body.offsetWidth
+"<br />"+
"網頁可見區域高(包括邊線的寬):"+document.body.offsetHeight
+"<br />"+
"網頁正文全文寬:"+document.body.scrollWidth
+"<br />"+
"網頁正文全文高:"+document.body.scrollHeight
+"<br />"+
"網頁被捲去的高:"+document.body.scrollTop
+"<br />"+
"網頁被捲去的左:"+document.body.scrollLeft
+"<br />"+
"網頁正文部分上:"+window.screenTop
+"<br />"+
"網頁正文部分左:"+window.screenLeft
+"<br />"+
"屏幕解析度的高:"+window.screen.height
+"<br />"+
"屏幕解析度的寬:"+window.screen.width
+"<br />"+
"屏幕可用工作區高度:"+window.screen.availHeight
+"<br />"+
"屏幕可用工作區寬度:"+window.screen.availWidth
);
}
function set_bgColor(){
document.body.style.backgroundColor="red";
}
function set_bgImg(){
document.body.style.backgroundImage="url(t/JS獲取屏幕大小 - 風飄零 - 博客園.png)";
}
</script>
<body onLoad="alert('init')" >
<input type='button' value="set_bgColor" onclick="set_bgColor();"> <br>
<input type='button' value="set_bgImg" onclick="set_bgImg()">
</body>
</html>
6. 關於JS獲取(判斷)不同屏幕大小,並根據屏幕的大小,調用不同的CSS,求大神給我一個例子,我看下。
下邊是JS獲得屏幕大小的方法,調用不同的CSS是給某個對象,設置不同CSS樣式嗎?
你最好說明你想要的效果。
<html>
<script>
function a(){
document.write(
"屏幕解析度為:"+screen.width+"*"+screen.height
+"<br />"+
"屏幕可用大小:"+screen.availWidth+"*"+screen.availHeight
+"<br />"+
"網頁可見區域寬:"+document.body.clientWidth
+"<br />"+
"網頁可見區域高:"+document.body.clientHeight
+"<br />"+
"網頁可見區域寬(包括邊線的寬):"+document.body.offsetWidth
+"<br />"+
"網頁可見區域高(包括邊線的寬):"+document.body.offsetHeight
+"<br />"+
"網頁正文全文寬:"+document.body.scrollWidth
+"<br />"+
"網頁正文全文高:"+document.body.scrollHeight
+"<br />"+
"網頁被捲去的高:"+document.body.scrollTop
+"<br />"+
"網頁被捲去的左:"+document.body.scrollLeft
+"<br />"+
"網頁正文部分上:"+window.screenTop
+"<br />"+
"網頁正文部分左:"+window.screenLeft
+"<br />"+
"屏幕解析度的高:"+window.screen.height
+"<br />"+
"屏幕解析度的寬:"+window.screen.width
+"<br />"+
"屏幕可用工作區高度:"+window.screen.availHeight
+"<br />"+
"屏幕可用工作區寬度:"+window.screen.availWidth
);
}
</script>
<body onload="a()" >
</body>
</html>
7. js如何獲取屏幕英寸(注意不是獲取解析度像素值啊)
你用捲尺量顯示屏的有效發光顯示面的對角線尺寸,記下有多少寸,然後用這個尺寸換算成英寸就可以了!
8. js如何根據不同屏幕的大小,獲得頁面高度,自動調整列表高度
varwin_w=$(window).width();//獲取寬度
varwin_h=$(window).height();//獲取高度
如果你想要匹配高度,那麼,就是頁面專剛剛打開其實沒有數據,屬是等頁面打開,計算了屏幕高度之後,再根據每條數據的高度計算出條數,再利用ajax的非同步傳輸去讀取列表,然後用JS呈現在手機網頁中的。
9. JS怎麼獲取屏幕大小本人剛學習JS,請教~
估計你是想找網頁的可是區域寬高,屏幕的寬高對你來說意義不大:
網頁可視區域寬高:
document.body.clientWidth
document.body.clientHeight
如果你堅持要屏幕寬高:
屏幕解析度的高: window.screen.height
屏幕解析度的寬: window.screen.width
10. js獲取手機屏幕的尺寸,主要是高度
||</head>
<p id="p1">sssss</p>
<body>
</body>
</html>
<script>
var x = navigator;
var w=window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var h=window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
document.getElementById("p1").innerHTML="<b>屏幕解析度:</b>"+screen.width + "*" + screen.height+"<b>內部窗口</b>:" + w + "*" + h
</script>
不知道是不是這個 屏幕解析度 :pc上的桌面解析度 。手機上是 一個型號固定的分辨