PHP Insert Map

Source: Internet
Author: User

CSS Styles1234<style>.iw_poi_title {color:#Cc5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap}. iw_poi_content {font:12px Arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap : Break-Word}</style>Map Container1<divclass= "Lx_left" id= "Ditucontent" >js Section1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 6667686970717273747576777879808182838485868788899091929394959697<script type= "Text/javascript" >//To Create and initialize a map function:functionInitmap () {createmap ();//Create a mapSetmapevent ();//Set Map EventsAddmapcontrol ();//adding controls to a mapAddmarker ();//add marker to your map} //To Create a map function:functionCreatemap () {varMap =NewBmap.map ("Ditucontent");//Create a map in the Baidu map container    varPoint =NewBmap.point (118.28238,36.811008);//Define a center point coordinate you can change the latitude and longitude coordinates to mark the location you want.Map.centerandzoom (point,15);//set the center point and coordinates of the map and display the map in the map containerWindow.map = map;//store the map variable in the global} //Map Event Settings function:functionsetmapevent () {map. enabledragging ();//Enable map drag events, enabled by default (can not be written)Map.enablescrollwheelzoom ();//Enable map wheel zoom in and zoom outMap.enabledoubleclickzoom ();//enable mouse double-click to enlarge, enabled by default (can not write)Map.enablekeyboard ();//enable keyboard to move the map up or down} //Add a function to the map control:functionAddmapcontrol () {//Add a zoom control to a mapvarCtrl_nav =NewBmap.navigationcontrol ({anchor:bmap_anchor_top_left,type:Bmap_navigation_control_large}); Map.AddControl (CTRL_NAV); //add a thumbnail control to your mapvarCtrl_ove =NewBmap.overviewmapcontrol ({anchor:bmap_anchor_bottom_right,isopen:1}); Map.AddControl (Ctrl_ove); //Add a scale bar control to a mapvarCtrl_sca =NewBmap.scalecontrol ({anchor:bmap_anchor_bottom_left}); Map.AddControl (CTRL_SCA);} //Callout Points GroupvarMarkerarr = [{title: "My Tag", content: "My Notes", point: "115.987765|36.456585", Isopen:0,icon:{w:21,h:21,l:0,t:0,x:6,lb:5}}     ];//Create markerfunctionAddmarker () { for(vari=0;i<markerarr.length;i++){        varJSON =Markerarr[i]; varP0 = Json.point.Split("|") [0]; varP1 = Json.point.Split("|") [1]; varPoint =NewBmap.point (P0,p1); varIconimg = Createicon (JSON.icon); varMarker =NewBmap.marker (Point,{icon:iconimg}); varIW =Createinfowindow (i); varLabel =NewBmap.label (json.title,{"offset":NewBmap.size (json.icon.lb-json.icon.x+10,-20)}); Marker.SetLabel (label); Map.Addoverlay (marker); Label.SetStyle ({bordercolor: "#808080",Color: "#333",cursor: "Pointer"        }); (function(){            varindex =i; var_IW =Createinfowindow (i); var_marker =marker; _marker. AddEventListener ("click",function() { this.Openinfowindow (_IW);            }); _iw. AddEventListener ("Open",function() {_marker. Getlabel ().Hide (); }) _iw. AddEventListener ("Close",function() {_marker. Getlabel ().Show (); }) Label. AddEventListener ("click",function() {_marker.Openinfowindow (_IW); })            if(!! Json.IsOpen) {Label.Hide (); _marker.Openinfowindow (_IW); }        })()    }}//Create InfowindowfunctionCreateinfowindow (i) {varJSON =Markerarr[i]; varIW =NewBmap.infowindow ("<b class= ' iw_poi_title ' title= '" + json.title + "' >" + json.title + "</b><div class= ' iw_p Oi_content ' > "+json.content+" </div> "); returnIW;}//Create an iconfunctionCreateicon (JSON) {varicon =NewBmap.icon ("Http://app.baidu.com/map/images/us_mk_icon.png",NewBmap.size (Json.w,json.h), {imageoffset:NewBmap.size (-JSON.L,-JSON.T), Infowindowoffset:NewBmap.size (json.lb+5,1), offset:NewBmap.size (Json.x,json.h)})returnicon;} Initmap ();//Creating and initializing maps</script>

PHP Insert Map

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.