Google Maps API code

Source: Internet
Author: User

Note: laizhi su Fei's blog cnblogs.com/sufei su Fei

  <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< Html Xmlns = "Http://www.w3.org/1999/xhtml" > < Head >

<% -- Load local search styles -- %>
< Style Type = "Text/CSS" >
@ Import URL ("http://www.google.com/uds/css/gsearch.css ");
@ Import URL ("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css ");
}
. Style1 {
Font-size : 12px ;
Color : #003366 ;
}
</ Style >
< Meta HTTP-equiv = "Content-Type" Content = "Text/html; charsets = UTF-8" />
< Title > Su Fei wishes you a safe journey </ Title >
<% -- Google Maps API enables you to embed Google Maps into your own webpage. A map API key is valid only for one "directory" or domain.
For more information, see this FAQ. You must have a Google account to obtain the Maps API key, which is associated with your Google account.
Please apply for an http: // Code.google.com / INTl / ZH - CN / APIS / Maps / Signup.html -- %>
< Script SRC = "Http://maps.google.com/maps? File = API & amp; V = 2 & amp; Key = ABQIAAAAomgcdg9DjL60HKYl-1QbnhRhywW8vKZVMFuSsAE3Eu0YRdhAXhTcj2-jOXN4Kbz6pCI4DnVhXqqW6g"
Type = "Text/JavaScript" > </ Script >
< Script SRC = "Http://www.google.com/uds/api? File = UDS. JS & amp; V = 1.0" Type = "Text/JavaScript" > </ Script >
< Script SRC = "Http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" Type = "Text/JavaScript" > </ Script >
< Script Type = "Text/JavaScript" >
// <! [CDATA [
VaR Geocoder =   Null ;
Function Load (){
If (Gbrowseriscompatible ()){
// Here is to enable a map
VaR Map =   New Gmap2 (document. getelementbyid ( " Map " ));
// Location of the map center
Map. setcenter ( New Glatlng ( 34.81552976499691 , 113.6833906173706 ), 13 );
// Enable mouse Scaling
Map. enablescrollwheelzoom ();
// Disable mouse Scaling
// Map. disablescrollwheelzoom ();
// Location of a local search
Map. addcontrol ( New Google. Maps. localsearch (), New Gcontrolposition (g_anchor_bottom_right, New Gsize ( - 260 , 0 )));
// Add satellites
Map. addcontrol ( New Glargemapcontrol ());
// Add Map
Map. addcontrol ( New Gmaptypecontrol ());
// Pan and zoom controls (upper left corner)
Map. addcontrol ( New Glargemapcontrol ());
// , Scale replacement (lower left)
Map. addcontrol ( New Gscalecontrol ());
// , Thumbnail Control (lower left)
Map. addcontrol ( New Goverviewmapcontrol ());
// Enable mouse dragging
Map. enabledragging ();
}
}
// ]>
</ Script >
</ Head >
< Body Onload = "Load ()" OnUnload = "Gunload ()" >
<% -- Load the map here -- %>
< Div ID = "Map" Style = "Width: 720px; Height: 500px" > </ Div >
</ Body >
</ Html >

 

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.