51地图实现地址解析:

 

  
    
51地图实现地址解析: < br >< html xmlns:v ="urn:schemas-microsoft-com:vml" >
< head >
< meta http-equiv ="content-type" content ="text/html; charset=GB2312" />
< meta name ="keywords" content ="LTLocalSearch,JavaScript,灵图,51ditu Search API,地图,范例文档" />
< title > 我要地图-地图API-范例-基本搜索 </ title >
< script language ="javascript" src ="http://api.51ditu.com/js/maps.js" ></ script >
< script language ="javascript" src ="http://api.51ditu.com/js/search.js" ></ script >

</ head >
< body >
< script language ="javascript" >
function showPoint(searchResult) // 定义搜索结果处理函数
{
if (searchResult.searchPoints.length > 0 ) // 如果存在搜索结果
{
var poi = searchResult.searchPoints[ 0 ]; // 搜索结果中的第一项
alert(poi.name + ' , ' + poi.point);
}
else
{
alert(
' 无结果 ' );
}
}
var search = new LTLocalSearch(showPoint);
search.setCity(
' 北京 ' ); // 设置城市
search.search( ' 灵图 ' ); // 开始搜索
</ script >

< input type ="text" id ="city" value ="上海市" size ="5" onchange ="search.setCity(this.value);" /> 市搜索
< input type ="text" id ="word" value ="上海市" size ="10" />
< input type ="button" onclick ="search.search(document.getElementById('word').value);" value ="搜索" />

</ body >
</ html >

 

 

你可能感兴趣的:(解析)