google.maps.LocalSearch VS. GSmapSearchControl

閲覧: 16 回
最初の未読メッセージにスキップ

mapsearch

未読、
2008/05/19 12:25:482008/05/19
To: Google AJAX API
Hello!

I have started a map using google.maps.LocalSearch. It works great but
I want to add Hot Spots as they are shown for GSmapSearchControl. Can
I do this using google.maps.LocalSearch?

Thanks!

jgeerdes [AJAX APIs "Guru"]

未読、
2008/05/19 13:40:442008/05/19
To: Google AJAX API
I don't think there is built-in support for hotspots, but you can
easily add the functionality. All you need to do is assign the would-
be hotspot an onclick listener like the following:

function(){myLocalSearchControl.execute("restaurant");}

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jgee...@mchsi.com

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

mapsearch

未読、
2008/05/19 14:43:312008/05/19
To: Google AJAX API
Thanks for helping Jeremy.

I think I need to define the search control because it has an
undefined error.

OK, here is what I have...

<script type="text/javascript">
//<![CDATA[
function initialize() {
if (GBrowserIsCompatible()) {

var icon = new GIcon();
icon.image = "link";
icon.iconSize = new GSize(30, 30);
icon.iconAnchor = new GPoint(5, 15);
icon.infoWindowAnchor = new GPoint(15, 5);

var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(38.435035,-76.446304), 15);

map.addControl(new GSmallMapControl());
map.addControl(new GScaleControl());
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl());

map.addControl(new google.maps.LocalSearch(
{
resultList : document.getElementById("results")
}),
new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new
GSize(0,-30)));

var marker = new GMarker(new GLatLng(88.435035,-86.446304), icon);
map.addOverlay(marker);

}
}
GSearch.setOnLoadCallback(initialize);
//]]>
</script>



<div>
<asp:HyperLink runat="server" NavigateUrl="#" onclick="hotspot()"
id="HyperLink1">HyperLink</asp:HyperLink>
<script type="text/javascript">
function hotspot(){MyLocalSearchControl.execute("restaurant");}
</script>
</div>



Where do I define "MyLocalSearchControl"??


On May 19, 1:40 pm, "jgeerdes [AJAX APIs \"Guru\"]"
<jgeer...@mchsi.com> wrote:
> I don't think there is built-in support for hotspots, but you can
> easily add the functionality.  All you need to do is assign the would-
> be hotspot an onclick listener like the following:
>
> function(){myLocalSearchControl.execute("restaurant");}
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.com
> jgeer...@mchsi.com

jgeerdes [AJAX APIs "Guru"]

未読、
2008/05/19 14:54:172008/05/19
To: Google AJAX API
Change this line:

map.addControl(new google.maps.LocalSearch());

To this:

map.addControl(window.MyLocalSearchControl=new
google.maps.LocalSearch());

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jgee...@mchsi.com
全員に返信
投稿者に返信
転送
新着メール 0 件