나는 다음과 같은 오류가 점점 오전 : 나는 Stickyfill 소스의 문제가자바 스크립트 - catch되지 않은 형식 오류 : '창'에 'getComputedStyle'을 실행하지 못했습니다이 : 매개 변수 1 유형이 아닌 '요소'
Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'
을 (https://github.com/wilddeer/stickyfill)
다른 버전을 사용해 보았는데 동일한 오류가 발생합니다. 내 JavaScript 소스는 다음과 같습니다.
var a = document.getElementById('left');
Stickyfill.add(a);
왜이 오류가 발생합니까? 어떻게 해결할 수 있습니까?
편집 :
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css-home.css">
<script type="text/javascript" src="stickyfill.js"></script>
<script type="text/javascript" src="js-home.js"></script>
</head>
<body>
<div id="container">
<div id="banner">
<img src="sigla.jpg">
</div>
<div id="container2">
<div id="left">
<nav>
<a target="ifr" href="">Home</a>
<a target="ifr" href="">Istoric</a>
<a target="ifr" href="echipa.html">Echipa</a>
<a target="ifr" href="">Galerie</a>
</nav>
</div>
<div id="right">
<iframe name="ifr" src="echipa.html" frameborder="0" ></iframe>
</div>
</div>
<div id="footer">
<p>CS MIOVENI</p>
</div>
</div>
</body>
</html>
LATER 편집 : 난 내 자바 스크립트 파일을 창로드을 사용하여 문제를 해결 한 이
언제 JS를 실행합니까? – ste2425
JS는 .html 페이지가로드 될 때 실행됩니다 (나는 그렇게 생각합니다). –