以下scipt返回文档(HTML文档)和窗口的宽度和高度。但它的返回错误。
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
var txt="";
txt+="Document width/height: " + $(document).width();
txt+="x" + $(document).height() + "\n";
txt+="Window width/height: " + $(window).width();
txt+="x" + $(window).height();
alert(txt);
});
});
</head>
<body>
<button>Display dimensions of document and window</button>
</body>
</html>
答案 0 :(得分:1)
在头标记
之前缺少结束<script>
标记
答案 1 :(得分:1)
右.. </script>
缺失,请替换下面的
</head>
<body>
通过
</script>
</head>
<body>