うーん

2006年10月11日 (水曜日) - 11:08:36 by webmaster

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オブジェクトを参照してる。

うーん。

と、思ったけど、致命的な勘違いをしてるような気がする。いま気がついた。
やば。

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>