如何在文本框中输入后显示引脚

时间:2014-02-13 16:09:33

标签: javascript google-maps

如何显示我在4个文本框中添加的地址(更改后更改引脚) 在我网站上的谷歌地图上? 我想要4个输入字段(邮编,城市,街道和门牌号码) 如果有超过4个字母,他必须向我显示卡片上的地址

我从下载页面尝试了民主代码

  $(function(){

$('#test').gmap3({
      map:{
        options:{
          center:[46.721976,14.180603],
          zoom:8,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          mapTypeControl: false,
          mapTypeControlOptions: false,
          navigationControl: false,
          scrollwheel: false,
          streetViewControl: false
        }
      }
    });


    $('#test-address').keydown(function(e){
      var addr = $('#test-address').val();
      if ( !addr || !addr.length ) return;
      $("#test").gmap3({
        getlatlng:{
          address:  addr,
          callback: function(results){
            if ( !results ) return;
            $(this).gmap3({
              marker:{
    latLng:results[0].geometry.location,
                map:{
                  center: true
                }
              }
            });
          }
        }
      });
    });

  });

但我需要从4个输入框组合。

我该怎么做?

1 个答案:

答案 0 :(得分:0)

在Html代码中,我有输入框和Gmap Div

这是来自demo文件夹。 我需要4个输入框(zip,city,street,housenumber)的组合,而不是1个输入框,演示脚本添加引脚而不删除之前完成的输入(如果我更改地址)