2011-01-12 5 views
2

3 번째 및 4 번째 입력이 채워지지 않는 이유는 무엇입니까?

<!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> 

답변

6

]의 누락 :

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()); 
    //      --^ 
} 
+0

오! 그것을 모두 지옥에 던져 버리십시오. –

+0

+1 멋진 오류 마크 업 – JakeParis

+0

@AIR 얼마나 오래 당신이 그걸 쳐다 보았습니까? :) – JakeParis

3

당신이 누락 닫는 괄호를 여기 :

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

오! 그것을 모두 지옥에 던져 버리십시오. –