मैं डेटा से कई स्थानों को प्रदर्शित करने के लिए एक स्थिर HTML पृष्ठ बना रहा हूं। मैं सिर्फ नमूने में से एक कॉपी किया है और पीछे की ओर काम कर रहे हैं, लेकिन मैं सफारी निरीक्षक में निम्न त्रुटि हो रही है:Google मानचित्र API v3 - TypeError: अभिव्यक्ति का परिणाम 'google.maps.LatLng' [अपरिभाषित] एक निर्माता नहीं है
main.js:1SyntaxError: Parse error
sample.htm:10TypeError: Result of expression 'google.maps.LatLng' [undefined] is not a constructor.
यहाँ मेरी html कोड है:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Multi Markers Sample via Google Maps</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(-30.2965590,153.1152650);
var myLatlng1 = new google.maps.LatLng(-30.2956470,153.1123707);
var myLatlng2 = new google.maps.LatLng(-30.2864430,153.1360230);
var myOptions = {
zoom: 13,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
icon: 'http://www.google.com/intl/en_us/mapfiles/ms/icons/blue-dot.png',
title:"Original Location" });
var marker = new google.maps.Marker({
position: myLatlng1,
map: map,
title:"Tom Cruise" });
var marker = new google.maps.Marker({
position: myLatlng2,
map: map,
title:"Lady Gaga" });
}
</script>
</head>
<body onLoad="initialize()">
<div id="map_canvas"></div>
</body>
</html>
मैं सुनिश्चित नहीं हूं मैं यहां क्या गलत कर रहा हूं - यह वास्तव में विंडोज़ पर आईई v8 में काम करता है लेकिन सफारी में नहीं है और मुझे इसे दोनों के लिए काम करने की आवश्यकता है।
+1 लाइफ सेवर दोस्त का उपयोग कर इस कोड का उपयोग करें; यह जवाब स्वीकार किया जाना चाहिए! – trojanfoe
शानदार .. +1 वास्तव में :) – KAsh
डॉको पढ़ें या स्टैक ओवरव्लो पर जाएं। धन्यवाद! – Greg0ry