うーん
2006年10月11日 (水曜日) - 11:08:36 by webmaster
JavaScript:
-
function GMGeocoding() {
-
this.content = document.getElementById("content");
-
this.regex = /\<!-- googlemap:({.*}) --\>/;
-
this.matches = this.content.value.match(this.regex);
-
this.geocode();
-
}
-
-
GMGeocoding.prototype.geocode = function() {
-
if (!this.matches) return false;
-
......
-
}
こんなコードをフォームのsubmitイベントから呼び出して処理をさせようと思ったら動かない。
「this.geocode is not a function」とか言われる。
何でかと思って調べたら、ここで呼び出してる this が自分自身を参照していなかたった。呼び出したフォームのDOMオブジェクトを参照してる。
うーん。
と、思ったけど、致命的な勘違いをしてるような気がする。いま気がついた。
やば。