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配置-LMLPHP

05-08 15:20