我的代码如下:
//在给定的坐标附近搜索指定的关键字
      function searchMap(initPt) {
          var myIcon = new GIcon(G_DEFAULT_ICON);
          var mapSearch = new KMapSearch(map, { latlng: initPt, icon: myIcon, keyWord: "学校|银行|超市" });
          mapSearch.clearAll();
          mapSearch.execute();
      }
var KMapSearch = window.KMapSearch = function (map_, opts_) {
          this.opts = { keyWord: opts_.keyWord || "", latlng: opts_.latlng || new GLatLng(31, 121), autoClear: opts_.autoClear || true, icon: opts_.icon || new GIcon(G_DEFAULT_ICON) };
          this.map = map_;
          this.gLocalSearch = new google.search.LocalSearch();//报错代码,google.search为空          this.gLocalSearch.setCenterPoint(this.opts.latlng);
          this.gLocalSearch.setResultSetSize(GSearch.LARGE_RESULTSET);
          this.gLocalSearch.setSearchCompleteCallback(this, myTips);
      }
原来好好的,这两天才报的错误,