doulingqiu4349 2010-07-20 17:18
浏览 11
已采纳

单击Google地图上的HTML表单

I'm new to Google maps and I'm wondering how would I program a Map which would pop out a HTML form when the user clicked a location on the map? I'd like the form to "pop out" of the map on screen. is this possible?

I've got the following...

         <script>
        var contentString = '<div id="content">
       <form action="welcome.php" method="post">
       <b>Name</b><br/> <input type="text" name="fname" />
       <br/><b>Description</b><br/>
       <TEXTAREA NAME="description" COLS=40 ROWS=6></TEXTAREA><br/><br/>
       <b>Latitude</b><br/><INPUT name="lat" id ="lat" /><br/>
       <b>Longitude</b><br/><INPUT name="lng" id ="lng" /><br/>
       <input type="submit" />
       </form>
       </div>';

var infowindow = new google.maps.InfoWindow({ content: contentString });

My on click listener is...

GEvent.addListener(map, "click", function(overlay, latLng)
{
    if (latLng) {
 marker = new GMarker(latLng, {draggable:true});
 map.addOverlay(marker);
 infowindow.open(latLng, map);
  }

    // display the lat/lng in your form's lat/lng fields
    document.getElementById("lat").value = latLng.lat();
    document.getElementById("lng").value = latLng.lng();
});

  }
}

What I want is on click It'll open a HTML form at the location where the user clicked and pass on the lat/lng fields to the HTML form. is this possible?

  • 写回答

1条回答 默认 最新

  • drra6593 2010-07-20 17:49
    关注

    All the information you need is in the documentation, along with an example - all you need to do is put the HTML form in there.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?