หากไม่มีความกังวลใจเพิ่มเติมฉันจะโพสต์รหัสให้คุณโดยตรง รหัสเฉพาะมีดังนี้
รหัสคีย์มีดังนี้:
<! doctype html> <html lang = "zh-cn"> <head> <meta name = "viewport" content = "เริ่มต้นระดับเริ่มต้น = 1.0, scalable ผู้ใช้ = no" /> <meta http-equiv = "content-type-type type type = "text/css"> html {ความสูง: 100%;} ร่างกาย {ความสูง: 100%; ระยะขอบ: 0px; padding: 0px;}#คอนเทนเนอร์ {ความสูง: 50%; src = "http://api.map.baidu.com/api?v=1.4" type = "text/javascript"> </script> <script type = "text/javascript" src = "http://developer.baidu.com/map/jsdemo/demo/demo/demo/demo/demo {navigator.geolocation.getCurrentPosition (TranslatePoint); initmap); // แปลงพิกัด} ฟังก์ชั่น initmap (จุด) {// เริ่มต้นแผนที่แผนที่ = ใหม่ bmap.map ("คอนเทนเนอร์"); // อินสแตนซ์คอนเทนเนอร์แผนที่. AddControl (ใหม่ bmap.navigationControl ()); bmap.overviewmapcontrol ()); // รูปทรงแผนที่ควบคุมแผนที่ Centerandzoom (จุด, 15); // การเริ่มต้นแผนที่, พิกัดแผนที่พารามิเตอร์และระดับแผนที่ Addoverlay (ใหม่ bmap.marker (จุด)); // marker (จุด); zoomcontrol (); map.addcontrol (myzoomctrl); ฟังก์ชั่น zoomcontrol () {this.defaultanchor = bmap_anchor_top_left; // ปรับตำแหน่งของการควบคุม this.defaultoffset = ใหม่ bmap.size (10, 10); // ปรับตำแหน่งผ่านพิกเซล} // ปรับแต่งการควบคุมคลิกสองครั้งเพื่อให้ได้การขยาย ZoomControl.prototype = new bmap.control (); zoomcontrol.prototype.initotialile document.createElement ("div"); div.AppendChild (document.createtextNode ("การซูม 2 ระดับ")); div.style.cursor = "ตัวชี้"; div.style.border = "1px Solid Grey"; 2);} map.getContainer (). AppendChild (div); return div;}} </script> </head> <body> <div id = "container"> </div> </body> </html>