<html>
<body>
<p>单击该按钮可显示屏幕的总宽度(以像素为单位)。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = "Total Width: " + screen.width + "px";
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>