うーん

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

JavaScript:
  1. function GMGeocoding() {
  2.     this.content = document.getElementById("content");
  3.     this.regex = /\<!-- googlemap:({.*}) --\>/;
  4.     this.matches = this.content.value.match(this.regex);
  5.     this.geocode();
  6. }
  7.  
  8. GMGeocoding.prototype.geocode = function() {
  9.     if (!this.matches) return false;
  10.     ......
  11. }

こんなコードをフォームの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>