我试图在某个位置的地图上放置一个标记,但它给了我错误的选项,但如果我单独加载地图它工作正常
这是我的代码
<script type="text/javascript"> //var map; function initialize() { if (GBrowserIsCompatible()) { var lat = parseFloat(document.getElementById("FormView1_LatitudeLabel").textContent); var lng = parseFloat(document.getElementById("FormView1_LongitudeLabel").textContent); // Creating a map // Creating a LatLng object containing the coordinate for the center of the map var latlng = new google.maps.LatLng(lat, lng); // Creating an object literal containing the properties we want to pass to the map var options = { zoom: 7, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, }; // Calling the constructor, thereby initializing the map var map = new google.maps.Map(document.getElementById('map'), options); var marker = new google.maps.Marker({ position: new google.maps.LatLng(lat, lng), map: map, title: 'My workplace', clickable: false, icon: 'img/factory.png' }); } } </script>