English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
width読み取り専用属性はスクリーンの全幅をピクセル単位で返します。
使用height属性はスクリーンの全高をピクセル単位で取得します。
screen.width
var x = "Total Width: " + screen.width;テストを試してみる‹/›
すべてのブラウザが完全にwidth属性をサポートしています:
属性 | |||||
width | は | は | は | は | は |
返り値: | ユーザーのスクリーンの全幅をピクセル単位で示す数字 |
---|
この例では、すべてのスクリーン属性を表示しています:
var txt = ""; txt += "<p>Total width/height: " + screen.width + "*" + screen.height + "</p>"; txt += "<p>Available width/height: " + screen.availWidth + "*" + screen.availHeight +"</p>"; txt += "<p>Color depth: " + screen.colorDepth + "</p>"; txt += "<p>Color resolution: " + screen.pixelDepth + "</p>"; document.write(txt);テストを試してみる‹/›
screen 参考情報:screen.availHeight属性
screen 参考情報:screen.availWidth属性
screen 参考情報:screen.colorDepth属性
screen 参考情報:screen.height属性
screen 参考情報:screen.pixelDepth属性