2
爲什麼第三和第四個輸入不被填充?這裏
爲什麼第三和第四個輸入不被填充?這裏
你少了兩根]
小號
$('input[name=DocumentHeight').val($(document).height());
$('input[name=DocumentWidth').val($(document).width());
你缺少右括號:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style>
label {
display:block;
}
</style>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1");
</script>
</head>
<body>
<form>
<label for="WindowHeight">Window Height:</label>
<input name="WindowHeight">
<label for="WindowWidth">Window Width:</label>
<input name="WindowWidth">
<label for="DocumentHeight">Document Height:</label>
<input name="DocumentHeight">
<label for="DocumentWidth">Document Width:</label>
<input name="DocumentWidth">
</form>
<script>
function Populate() {
$('input[name=WindowHeight]').val($(window).height());
$('input[name=WindowWidth]').val($(window).width());
$('input[name=DocumentHeight').val($(document).height());
$('input[name=DocumentWidth').val($(document).width());
}
$(window).resize(function() {
Populate();
});
Populate();
</script>
</body>
</html>
哦!全力以赴。 – 2011-01-12 19:21:27
+1對於很酷的錯誤標記 – JakeParis 2011-01-12 19:21:43