Code
<% @ Page Language = " C # " Autoeventwireup = " True " Codefile = " Default3.aspx. CS " Inherits = " Default3 " %>
<! 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 Runat = "Server" >
< Title > 51 Map </ Title >
< Script Type = "Text/JavaScript" SRC = "Http://api.51ditu.com/js/maps.js" > </ Script >
< Script Type = "Text/JavaScript" SRC = "Http://api.51ditu.com/js/ezmarker.js" > </ Script >
</ Head >
< Body >
< Form ID = "Form1" Runat = "Server" >
Longitude: < Input Runat = "Server" Type = "Text" ID = "X" Name = "X" />
Latitude: < Input Runat = "Server" Type = "Text" ID = "Y" Name = "Y" />
Scale level: < Input Runat = "Server" Type = "Text" ID = "Z" Name = "Z" />
< Div ID = "Mymap" Style = "Position: relative; width: 400px; Height: 300px ;" >
</ Div >
< Script Type = "Text/JavaScript" >
VaR Maps = New Ltmaps ( " Mymap " );
Maps. citynameandzoom ( " Chongqing " , 5 );
// Add scaling Control
VaR Control = New Ltsmallmapcontrol ();
Maps. addcontrol (control );
// Add a drop-down box zoom-in control
VaR Control = New Ltzoomincontrol ();
Maps. addcontrol (control );
// Add a tag
VaR Marker1 = New Ltmarker ( New Ltpoint ( 11636224 , 3991040 ));
VaR Marker2 = New Ltmarker ( New Ltpoint ( 11641152 , 3992640 ));
Maps. addoverlay (marker1 );
Maps. addoverlay (marker2 );
// Add a tag
VaR Point = New Ltpoint ( 11640969 , 3989945 ); //
VaR Marker = New Ltmarker (point );
Maps. addoverlay (Marker );
VaR Infowin = New Ltinfowindow (Marker );
Infowin. setlabel ( " <A href = 'HTTP: // www.51ditu.com 'target =' _ blank '> http://www.51ditu.com </a> " );
Maps. addoverlay (infowin );
// Keyboard Operation Support
Maps. handlekeyboard ();
// Scroll wheel support
Maps. handlemousescroll ();
// Implement the setmap method of the system
Function Setmap (point, zoom)
{
Document. getelementbyid ( " X " ). Value = Point. getlongpolling ();
Document. getelementbyid ("Y"). Value=Point. getlatitude ();
Document. getelementbyid ("Z"). Value=Zoom;
}
VaR EZ = New Ltezmarker ( " Ezmarker " );
EZ. setdefaultview ( " Chongqing " , 10 ); // The map is located in Chongqing by default.
EZ. setplacelist ( True ); // Display the map search control on the map
EZ. setsearch ( True , " Chongqing " ); // Display the search control on the map and specify the default search City as Chongqing.
Ltevent. addlistener (EZ, " Mark " , Setmap ); // "Mark" indicates an event.
</ Script >
</ Form >
</ Body >
</ Html >