Information Window----- Text-only Information Window
To help you easily prompt users, add a text information window in the specified area of the map to give users a visual display of information. The following shows how to add a text-only information window.
Add a text window as follows:
/** Add plain text information window */function addTextInfoWindow (map) {var opts = {width: 200, // information window width height: 60, // information window height title: "Xi'an Merrill Lynch Electronic Co., Ltd.", // message window title enableMessage: true, // set to allow the message window to send short message: "Welcome to Xi'an Merrill Lynch Electronic Co., Ltd. for employment... "// information} var infoWindow = new BMap. infoWindow ("Address: 501, Block C, hanyunge, Xi'an Software Park, no. 2 Science and Technology Road", opts); // create an information window object map. openInfoWindow (infoWindow, map. getCenter (); // open the Information Window}
----- Complex information window
The Information Window constantly displays plain text, images, and other complex information. This requires some html basics. The following describes how to add a complex text information window.
/** Add complex information window */function addComplexInfoWindow (map) {// concatenate an html string var sContent = "hanyunge" + "" +"Hanyunge is located in Xi'an Software Park...
"+" "; Var marker = new BMap. marker (map. getCenter (); var infoWindow = new BMap. infoWindow (sContent); // create an information window object map. addOverlay (marker); marker. addEventListener ("click", function () {// call the openInfoWindow method of the marker object this. openInfoWindow (infoWindow );});}
Source: http://blog.csdn.net/ysjian_pingcx/article/details/22662353