0
我嘗試Google Maps API並遇到小問題。看下面的這個例子。我想在進入網站時打開Infobox(不像谷歌的這個例子中,它是由點擊事件觸發並觸發的)。如何管理這個?也許這是一個初學者的問題的谷歌地圖API的親^^Google Maps API InfoWindow應該默認打開
> function initialize() {
> var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
> var myOptions = {
> zoom: 4,
> center: myLatlng,
> mapTypeId: google.maps.MapTypeId.ROADMAP
> }
>
> var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
>
> var contentString = '<div id="content">'+
> '<div id="siteNotice">'+
'hello world</div>'+
> '</div>';
>
> var infowindow = new google.maps.InfoWindow({
> content: contentString
> });
>
> var marker = new google.maps.Marker({
> position: myLatlng,
> map: map,
> title: 'Uluru (Ayers Rock)'
> });
> google.maps.event.addListener(marker, 'click', function() {
> infowindow.open(map,marker);
> }); }