0

first: english is not my language, but I try :-)

I like to have a map with markers. The map without marker works fine, you can see it here: map without markers

The code is just simple:

<!DOCTYPE html>
<html>
<head>
<title>MyRange Driving Ranges world wide </title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />

<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 30px; padding: 0px }
#map_canvas { height: 80% }
</style>
<script type="text/javascript"
src="https://maps.google.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(51.1601369818597, 6.72036588191986);
var myOptions = {
  zoom: 16,
  center: latlng,
  mapTypeId: google.maps.MapTypeId.HYBRID
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

//var image = 'http://myrange.de/support/images/flag_red_big.png';
//var myLatLng = new google.maps.LatLng(51.1601369818597, 6.72036588191986));
//var golfMarker = new google.maps.Marker({ position: myLatLng,map: map, icon: image });
}
</script>
</head>
<body onload="initialize()">
<div align="center" id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>

all works fine. If I delete the // than I get an empty screen :-( what is wrong in this 3 lines?

var image = 'http://myrange.de/support/images/flag_red_big.png';
var myLatLng = new google.maps.LatLng(51.1601369818597, 6.72036588191986));
var golfMarker = new google.maps.Marker({ position: myLatLng,map: map, icon: image });

I hope you can understand my "english"

greetings from germany hape42

4

1 回答 1

4

你的代码在行中断

var myLatLng = new google.maps.LatLng(51.1601369818597, 6.72036588191986));

它有一个额外的右括号。纠正它,它会工作。来自印度好友的问候.. :)

于 2012-08-07T12:13:28.150 回答