Google Maps API beginner 3

Source: Internet
Author: User

From: http://hi.baidu.com/xfm_zhr/blog/item/c3fcac13d44996876438db48.html

1.Ginfowindow object

Objects that provide information. Compared with the title attribute of the gmarker object, ginfowindow not only displays information on the gmarker object, but also displays information at any point on the map. The displayed content can be simple text or HTML.

2.Ginfowindowtab object

Supports information windows with multiple tags.

Declaration method: New ginfowindowtab (Label, content );

Content: HTML string or DOM object.

Typical examplesCode:

// Create a ginfowindowtab Array

VaR tabs = [New ginfowindowtab ("tab1", "<Div style = 'width: 400px '> This is tab1 </div> "),

New ginfowindowtab ("tab2", "<Div style = 'width: 400px '> This is tab2 </div> "),

New ginfowindowtab ("tab3", "<Div style = 'width: 400px '> This is tab3 </div>")];

3.About Removing inactive objects

Information window:

Ginfowindow and ginfowindowtab are both gmap2.closeinfowindow (). In googlemapsapi, only one window can be activated.

Gcontol Control

Gmap2.removecontrol (Control)

Control: the gcontol control to be removed.

Gmarker landmarks

Gmap2.removeoverlay (overlay ).

Overlay: The gmarker landmark to be removed.

Gmap2.removeoverlays ()

Remove all landmarks.

4.Gxmlhttp object

Creating gxmlhttp objects there is basically no difference between Ajax and xmlhttprequst objects, but browser compatibility is not required.

Sample Code:

// Create a gxmlhttp object

VaR request = gxmlhttp. Create ();

// Open gxmlhttp. Three parameters can be set here.

// 1: Obtain method and determine whether to use the get or POST method.

// 2: file name to be obtained

// 3: the retrieval mode. The asynchronous mode is true, and the synchronous mode is false.

Request.open(getask,myfile.txt ", true );

// Callback function. function () {…} can be used (){...} This API is called directly here.

// You can also pre-define the function XXX (), and assign the value request. onreadystatechange = xxx here

Request. onreadystatechange = function ()

{

Alert (request. responsetext );

}

// Send information

Request. Send (null );

5.Gdownloadurl () function

A simplified asynchronous processing function. You can only use the get method without judging the loading status, but only call the callback function after full loading. Call method:

Gdownloadurl (URL, onload );

Http://hi.baidu.com/fc/editor/get get URL

Onload: the fully loaded callback function.

 

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.