Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   Не работает функция инфоокна (https://javascript.ru/forum/misc/14769-ne-rabotaet-funkciya-infookna.html)

tomAlba 30.01.2011 00:54

Не работает функция инфоокна
 
Хочу получить маркеры, которые устанавливаются по клику и инфоокна к ним, которые открываются также по клику. Первое сделать удалось. Второе никак. Пожалуйста, помогите понять причину и устранить ее. Заранее благодарен.
(function() {
	window.onload = function() {
		var options = {
			zoom: 12,
			center: new google.maps.LatLng(40.7257, -74.0047),
			mapTypeId: google.maps.MapTypeId.ROADMAP,
			draggableCursor: 'crosshair',	
		};
		// Creating the map
		var map = new google.maps.Map(document.getElementById('map_canvas'), options);
		// Me Adding a click event to the map
		google.maps.event.addListener(map, 'click', function(event){
			placeMarker(event.latLng);
		});
		function placeMarker(location) {
			var marker = new google.maps.Marker({
			position: location,
			draggable: true,
			map: map,
			title: 'Click me up!'
			});
			var location = new google.maps.event.LatLng;
			var infowindow = new google.maps.InfoWindow ({ content: 'fuck' });
			google.maps.event.addListener(marker, 'click', function() {
			infowindow.open(map,marker);
			});
		};
	};
})();


Часовой пояс GMT +3, время: 15:50.