Google map is implemented in the project:
First you need to introduce the <SCRIPT src = "http://maps.google.com/maps? File = API & amp; V = 2 & amp; sensor = true & amp; Key = ABQIAAAAY92WzbL-lY1eE3IPdMNEvRSWy9ILSfG2C6fHg9Q_Zaz2MxGGORSOFohA5OJsZ76dORjdamlymzeWvg "type =" text/JavaScript "> </SCRIPT>
.
<SCRIPT type = "text/JavaScript">
Function initialize (){
VaR lat = Document. getelementbyid ("Lat"). value; // degree
VaR lng = Document. getelementbyid ("LNG"). value; // longitude
VaR size = 15; // map multiple: 1-23
VaR message = Document. getelementbyid ("name"). value;
If (gbrowseriscompatible ()){
VaR map = new gmap2 (document. getelementbyid ("map_del "));
Map. setcenter (New glatlng (Lat, LNG), size); // map coordinate information
Map. addcontrol (New gsmallzoomcontrol (); // scaling button control
Map. addcontrol (New ghierarchicalmaptypecontrol (); // nested map Type Control
}
VaR markobj = new gmarker (New glatlng (Lat, LNG), {draggable: true}); // Add icon
Markobj. openinfowindowhtml (Message); // The message is displayed.
Gevent. addlistener (markobj, "Mouseover", function () {// Add a Time Message
Markobj. openinfowindowhtml (Message );
});
Map. addoverlay (markobj );
}
Window. onload = initialize;
</SCRIPT>
Sometimes, you may find that keys are required when the project is running on the server.
You need to register Google map API from http://code.google.com/intl/zh-cn/apis/maps/signup.html,
In my text box, you can enter your IP address or your domain name (www.962.16.net ),
Then modify the generated key. In the following example, I generated the key with 192.168.1.44. We can notice that there is a key/value in the middle, sensor = true_or_false, and change it to sensor = true.
<SCRIPT src = "http://maps.google.com/maps? File = API & amp; V = 2 & amp; sensor =True_or_false& Amp; Key = ABQIAAAAY92WzbL-lY1eE3IPdMNEvRSIMweZSjbRtcUk2F5YNqLnri0MahQISU-YWznLEfyyR0a3619ZnoYkuQ "type =" text/JavaScript "> </SCRIPT>...
A little more"
Generally, when we release a project to the server, we need to modify the key value. Then we only need to put the key in webconfig,
<SCRIPT type = "text/JavaScript" src = "<% = readgoogle %>"> </SCRIPT>
Page Background:
Public String readgoogle = "";
Public void page_load (Object sender, eventargs E)
{
Readgoogle = configurationmanager. etettings ["maps"]. tostring ();
}
Webconfig Configuration
<Deleetask> <add key = "maps" value = "http://maps.google.com/maps/api/js? Sensor = true "/> </appsettings>