嗨,我有以下代碼,每次我嘗試添加一個按鈕它不起作用。這是我目前的代碼。有人可以告訴我如何添加一個按鈕,單擊時顯示一個警告框。如何添加一個按鈕,谷歌地圖infowindow
var infowindow = new google.maps.InfoWindow({
content: " "
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent('<p>Event Name: '+this.title+'</p>' +
'<p>Event Type: '+this.etype+'</p>' +
'<p>Cause: '+this.cause+'</p>' +
'<p>Date: '+this.date+'</p>' +
'<p>Time: '+this.time+'</p>' +
'<button onclick="myFunction()"> 'Click me'</button>');
infowindow.open(map, this);
});
});
如何你想添加一個按鈕?必要時必須小心引號,單引號和轉義引號。 – geocodezip
[InfoWindows中的函數調用](http://stackoverflow.com/questions/21327691/function-calls-within-infowindows) –
il更新代碼並顯示給您。謝謝 – codingman