嗨,我正在尝试将按钮放在信息窗口中,当我单击按钮时,应该至少会发生一些动作。下面是我的代码
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
zoom: 7,
center: new google.maps.LatLng(12.98,77.59),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map'), mapOptions);
var infoWindow = new google.maps.InfoWindow();
(function() {
var marker = new google.maps.Marker({
map: map,
draggable: false,
position: new google.maps.LatLng(12.98,77.59)
});
var content = "<div id='tabs'>"+
"<form id='button'>"+
"<div>"+
"<input type='button' onclick='alert(infoWindow)'>"+
"</div>"+
"</form>"+
"</div>";
google.maps.event.addListener(marker, 'click', function(event) {
infoWindow.setContent(content);
infoWindow.open(map, marker);
});
})();
};
</script>
</head>
<body onload="initialize()">
<div id="map" style="width:400px; height:300px"></div>
</body>
</html>
在这里我可以添加按钮但无法使其工作..任何帮助将不胜感激