js:

<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=3093b00bc02c380333bad7ff269cb30f"></script>

html:

<form class="form-horizontal form" action="" method="post">
  <h4>LBS配置</h4>
  <table class="tb">
    <tr>
      <th>所在位置</th>
      <td>
        <div id="allmap" style="height:500px;width:500px;">sssssssss</div>
        <input type="text" id="x" value="108.9527" name="x" />
        <input type="text" id="y" name="y" value="34.359132" />
        <div class="help-block">请在地图中查找到公司的具体位置,并点击获取X,Y</div>
      </td>
    </tr>
    <tr>
      <th></th>
      <td>
        <input name="submit" type="submit" value="提交" class="btn btn-primary span3">
        <input type="hidden" name="token" value="4e113bd0">
      </td>
    </tr>
  </table>
</form>

调用:

<script type="text/javascript">
  // 百度地图API功能
  var map = new BMap.Map("allmap");
  map.centerAndZoom(new BMap.Point(108.95367, 34.27934), 12);
  function showInfo(e){
    document.getElementById("x").value = e.point.lng; 
    document.getElementById("y").value = e.point.lat;
  }
  map.addEventListener("click", showInfo);
  map.enableScrollWheelZoom(true);
</script>

显示:

 LBS配置

 

相关文章:

  • 2022-01-17
  • 2021-08-07
  • 2022-12-23
  • 2022-01-02
  • 2021-07-24
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
猜你喜欢
  • 2022-03-08
  • 2021-11-16
  • 2022-12-23
  • 2021-08-28
  • 2021-11-15
  • 2022-02-08
  • 2022-12-23
相关资源
相似解决方案