gpt4 book ai didi

javascript - 标记错误

转载 作者:行者123 更新时间:2023-12-02 19:21:41 25 4
gpt4 key购买 nike

我试图在某个位置的 map 上放置一个标记,但它给了我错误的选项,但如果我单独加载 map ,它工作正常

这是我的代码

<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>

最佳答案

GBrowserIsCompatible() 是 V2 方法,但其余代码是 V3,您必须决定单个 API 版本。

关于javascript - 标记错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12478208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com