我有以下代碼JavaScript錯誤未定義的對象,儘管對象存在
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<div class="full-details-box" name="full_details_box" id="full-details-box"></div>
<hr />
<script type='text/javascript'>
function show_3136(){
document.full_details_box.style.display='block';
}
show_3136();
</script>
</body>
</html>
我得到的錯誤:window.document.full_details_box未定義
我得到的錯誤行:
document.full_details_box.style.display='block';
但是我確實有一個名爲full_details_box
的<div>
元素,爲什麼這個錯誤?