多年前,我很难为我的网站制作带有标记的谷歌地图。 我正在为 paypal 植入 ssl,我刚刚检查发现 map 不适用于 https: 所以我进入谷歌地图寻求解决方案,发现 javascript 已被弃用,他们建议升级到版本 3。 有没有简单的方法或一些教程,因为我正忙于尝试集成 paypal,而上次并不容易。有什么建议吗?
我的 map 是这样的:
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", enter code herefunction() {
marker.openInfoWindowHtml(html);
});
return marker;
}
// Display the map, with some controls and set the initial location
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(36.51308543049258, -4.886341094970703), 13);
// Set up three markers with info windows
var point = new GLatLng(36.50856685143835, -4.866085052490234);
var marker = createMarker(point,'<div style="width:240px">Text here<a href="link here">Link<\/a><\/div>')
map.addOverlay(marker);
谢谢
最佳答案
使用 v2 reference和 migration table创建文本文件:
v2 v3 GMap2 google.maps.Map GLatLng google.maps.LatLng GInfoWindow google.maps.InfoWindow GMapOptions google.map.MapOptions G_API_VERSION google.maps.version GPolyStyleOptions google.maps.PolygonOptions or google.maps.PolylineOptions
then run find/replace in one way or another:
for func in `cat deprecated.txt`
do
grep -R $func /path/to/src
done
引用资料
- > Migrating to a newer version of PHP
- > Advanced Find & Replace / Text Expand / Macros
- > Conditional Awk hashmap match lookup
- > awk/sed: How to do a recursive find/replace of a string?
- > How do I move files from an old folder structure to new?
- > https://stackoverflow.com/questions/715457/how-do-you-implement-a-dispatch-table-in-your-language-of-choice/13999292
关于javascript - 如何轻松地将 javascript 版本迁移到谷歌地图的新版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13668833/