You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.2 KiB

8 years ago
  1. <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  2. <title>百度地图</title>
  3. <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=4d555dbf90449a9845572a5c57d40a4f"></script>
  4. </head><body>
  5. <div style="width:<?php echo $_GET["width"]; ?>px;height:<?php echo $_GET["height"]; ?>px;border:1px solid gray" id="container"></div>
  6. <script type="text/javascript">
  7. /* 坐标获取到:http://api.map.baidu.com/lbsapi/getpoint/index.html
  8. * 案例:http://www.72p.org/other/map.php?x=118.122577&y=24.473587&width=300&height=200
  9. */
  10. var map = new BMap.Map("container");
  11. map.centerAndZoom(new BMap.Point(<?php echo $_GET["x"]; ?> ,<?php echo $_GET["y"]; ?>), 18);
  12. map.enableScrollWheelZoom();
  13. var marker=new BMap.Marker(new BMap.Point(<?php echo $_GET["x"]; ?> ,<?php echo $_GET["y"]; ?>));
  14. map.addOverlay(marker);
  15. function gotobaidu(type)
  16. {
  17. if($.trim($("input[name=origin]").val())=="")
  18. {
  19. alert("请输入起点!");
  20. return;
  21. }else{
  22. if(type==1)
  23. {
  24. $("input[name=mode]").val("transit");
  25. $("#gotobaiduform")[0].submit();
  26. }else if(type==2)
  27. {
  28. $("input[name=mode]").val("driving");
  29. $("#gotobaiduform")[0].submit();
  30. }
  31. }
  32. }
  33. </script>
  34. </body></html>