2017-06-14 8 views
-1

ボタン付きのテキストボックスに座標があります。テキストボックスから座標を取得し、Googleマップと連結しようとしています。私は自分のウェブサイトに地図や何かを見せたくありません。私はちょうど私の座標をテキストボックスから取って、新しいタブで地図を開いて座標にしたいと思う。私の現在のロジック:JavaScriptで座標を指定して別のタブでGoogleマップを開くにはどうすればよいですか?

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

+0

上記のコードで動作しないものはありますか? –

+0

地図上にマーカーが表示されないという問題がありますか? –

答えて

1
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 hereenter image description here

+0

次のURLを試してみてください:https://www.google.com.sa/maps/search/500,500,12.21z – DazDylz

+0

検索には私の座標がありますか?どこに私の座標を置くのですか? –

+0

google.com.sa/maps/search/[here],[ここで]、12.21z – DazDylz

関連する問題