2
하는 방법입니다 :이 방법으로지도 API를 실행하면 이제구글지도 API는, 콜백 나는이를 제외하고 여기에 모든 코드 한 줄 찢어 한 객체
show = foo.show = function() {
alert("test");
};
를, 그것은 작동 :
foo.display = function() {
this.elem = document.getElementById('fooBox');
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=show";
document.body.appendChild(script);
};
하지만이 callback=foo.show
통해 전화를 할 때 실패합니다 : I 양식 웹 얻을 수
foo.display = function() {
this.elem = document.getElementById('fooBox');
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=foo.show";
document.body.appendChild(script);
};
유일한 오류 키트 검사기는 Uncaught TypeError: Cannot call method 'show' of undefined
입니다.
Google지도 API가 처음이지만 메소드가 중요하지 않다고 생각 했겠습니까? 나는 그것이 어딘가에서 행해지는 것을 보았다고 확신한다. 여기서 내가 뭘 잘못하고 있니?
나를 위해 일했습니다. 고마워. –