javascript: Window.size

Để xác định kích thước thật cửa sổ bộ duyệt, sử dụng những thuộc tính sau đây
* in Netscape Navigator 4:
window.innerWidth, window.innerHeight
* in Microsoft Internet Explorer:
document.body.offsetWidth, document.body.offsetHeight
Chú ý document.body.offsetWidth và document.body.offsetWidth phải đặt trong tag Body mới có thế get value:

var winW = 630, winH = 460;

if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth;
winH = window.innerHeight;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}

Hiện nội dung:

document.write(
"Window width = "+winW+"<br>"
+"Window height = "+winH
)

Popularity: 10% [?]


  1. No comments yet.

  1. No trackbacks yet.

Chọn kiểu gõ: Tự động TELEX VNI Tắt

Bad Behavior has blocked 48 access attempts in the last 7 days.