2011-01-12 37 views

回答

6

你少了兩根]小號

$('input[name=DocumentHeight').val($(document).height()); 
$('input[name=DocumentWidth').val($(document).width()); 
+0

哦!全力以赴。 – 2011-01-12 19:21:27

+0

+1對於很酷的錯誤標記 – JakeParis 2011-01-12 19:21:43

3

你缺少右括號:

<!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> 
相關問題