주소 확인 실패 시 검색 주소 추가 Maker

1345 단어 htmlfunctiongenerator
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
</head>

<body>
<div id="divMap" style="width:1000px;height:500px;border:solid 1px gray"></div>
<script type="text/javascript">
var map = new BMap.Map("divMap");
map.centerAndZoom(new BMap.Point(108.953653, 34.273431), 12); // 
var gc = new BMap.Geocoder();
gc.getPoint(" ", function(pt){
if(pt){
map.addOverlay(new BMap.Marker(pt)); // , marker
}else{
var ls = new BMap.LocalSearch(" ");
ls.search(" ");
ls.setSearchCompleteCallback(function(rs){
if (ls.getStatus() == BMAP_STATUS_SUCCESS){
var poi = rs.getPoi(0); // 1 
if(poi){
var pt2 = poi.point;
map.addOverlay(new BMap.Marker(pt2)); // , marker
}
}else{
alert(" ");
}
});
}
}, " ");
</script>
</body>
</html>

좋은 웹페이지 즐겨찾기