<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text ml; charset = UTF-8">
<Title> </title>
<SCRIPT type = "text/JavaScript" src = "http://api.map.baidu.com/api? V = 1.3 "> </SCRIPT>
</Head>
<Body>
<Div style = "position: absolute; width: 730px; Height: 590px; top: 50; left: 0; Border: 1px solid gray; overflow-Y: hidden; "id =" Container "> </div>
<Input id = "text _" type = "text" value = "Shanghai"/>
<Input type = "button" value = "Search" onclick = "searchbystationname ();">
</Body>
<SCRIPT>
VaR map = new bmap. Map ("Container ");
Map. centerandzoom ("Beijing", 6 );
VaR localsearch = new bmap. localsearch (MAP ,{
Renderoptions :{
Pagecapacity: 8,
Autoviewport: True,
Selectfirstresult: false
}
});
Localsearch. enableautoviewport ();
Function searchbystationname ()
{
VaR keyword = Document. getelementbyid ("text _"). value;
Localsearch. setsearchcompletecallback (function (searchresult ){
VaR poi = searchresult. getpoi (0 );
Alert (POI. Point. lng + "+ POI. Point. LAT );
Map. centerandzoom (POI. Point, 8 );
});
Localsearch. Search (keyword );
}
</SCRIPT>
</Html>