為什么下面代碼在本課程里能看到效果,在vscode里選擇瀏覽器打開看不到?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>屏幕分辨率的高和寬</title>
</head>
<body>
<script type="text/javascript">
var s ="網頁可見區(qū)域寬:"+ document.body.clientWidth;?
? ? ? s+="\r\n網頁可見區(qū)域高:"+ document.body.clientHeight;?
? ? ? ? s += "\r\n網頁正文全文寬:"+ document.body.scrollWidth;?
? ? ? ?s += "\r\n網頁正文全文高:"+ document.body.scrollHeight;?
? ? ? ? s += "\r\n網頁正文部分上:"+ window.screenTop;?
? ? ? ?s += "\r\n網頁正文部分左:"+ window.screenLeft;?
? ? ? ?s += "\r\n屏幕分辨率的高:"+ window.screen.height;?
? ? ? ?s += "\r\n屏幕分辨率的寬:"+ window.screen.width;?
? ? ? ? s +="\r\n屏幕可用工作區(qū)高度:"+ window.screen.availHeight;?
? ? ? ? s +="\r\n屏幕可用工作區(qū)寬度:"+ window.screen.availWidth;?
alert(s);?
document.write(s) ;
</script>
</body>
</html>
2019-03-28
應該是瀏覽器不兼容