2
IE7/WinXP32에서 아래 코드를 실행하면 콘솔의 출력이 "정의되지 않음"입니다.excanvas + Dojo : getContext가 정의되지 않았습니다.
- I 이미지 태그를 삭제 : 예상에 대한 출력 변화 "는 getContext()는"I 두 변형 어느 할 때.
- 내가 사용 : < 신체 온로드는 = "그릴()">
어떤 생각 무슨 일이야? 해결 방법은 무엇입니까?
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Canvas</title>
<script type="text/javascript">
var djConfig = {parseOnLoad: false, isDebug: true};
</script>
<script type="text/javascript"
src="/development/javascript/dojo-release-1.4.3-src/dojo/dojo.js">
</script>
<!--[if IE]>
<script type="text/javascript" src="/javascript/excanvas_r73.js"></script>
<![endif]-->
<script type="text/javascript">
function draw() {
var canvas = dojo.byId("canvas");
console.log(canvas.getContext);
}
dojo.addOnLoad(draw);
</script>
</head>
<body>
<canvas id="canvas" width="100" height="100"></canvas>
<img src="nonexisting.gif">
</body>
</html>
업데이트 : "dojo.addOnLoad (draw);" 다음 코드로 트릭을 수행합니다.
function init() {
dojo.addOnLoad(draw);
}
if (dojo.isIE) {
dojo.connect('onload', init);
} else {
init();
}
지적 해 주셔서 감사합니다! Explorer Canvas의 초기화로 "onreadystatechange"가 실행됩니다. – feklee