gpt4 book ai didi

javascript - 如何在另一个选项卡中使用 JavaScript 中的坐标打开 Google map ?

转载 作者:行者123 更新时间:2023-11-28 17:55:37 25 4
gpt4 key购买 nike

我在带有按钮的文本框中有坐标。我试图从文本框中获取坐标并与谷歌地图连接。我不想在我的网站上显示任何 map 或其他内容。我只想从文本框中获取坐标,然后在带有坐标的新选项卡中打开 map 。我目前的逻辑:

var coordinates = $('#coordinates').val();
var url = "https://www.google.com.sa/maps/"+ coordinates +",12.21z?hl=en"

$("#map").on('click', function () {
window.open(url, '_blank');
});

修改:我想用标记显示这样的内容:

enter image description here

并显示:enter image description here

最佳答案

var coordinates, url;

$("#map").on('click', function () {
coordinates = $('#coordinates').val();
url = "https://www.google.com.sa/maps/search/"+ coordinates +",12.21z?hl=en";

window.open(url, '_blank');
});

要进行缩放,您需要使用这些值: enter image description here enter image description here

关于javascript - 如何在另一个选项卡中使用 JavaScript 中的坐标打开 Google map ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44537906/

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