Baidu map API-Information Window

Source: Internet
Author: User

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



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.