日期:2014-05-17 浏览次数:20758 次
<%@ page language="java" contentType="text/html; charset=GBK"
pageEncoding="GBK"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>本地搜索配置</title>
<script type="text/javascript"
src="http://api.map.baidu.com/api?key=46ce9d0614bf7aefe0ba562f8cf87194&v=1.1&services=true">
</script>
</head>
<body onload="load()">
<%
String scname = request.getParameter("scname");
if (scname == null) {
scname = "";
} else {
scname = new String(scname.getBytes("iso-8859-1"), "gbk");
}
%>
<form action="#"><input type="text" name="scname"
value="<%=scname%>" id="scname" /><input type="submit" value="提交" /></form>
<div style="width: 800px; height: 400px; border: 1px solid gray"
id="container"></div>
<div id="results"
style="width: 800px; height: 100px; font-size: 13px; margin-top: 10px;"></div>
</body>
<script type="text/javascript">
var map = new BMap.Map("container");
map.centerAndZoom(new BMap.Point(123.432791, 41.808645), 12);
function load() {
var scname = document.forms[0].scname.value;
if (scname != null && scname.length > 0) {
var local = new BMap.LocalSearch("沈阳市", {
renderOptions : {
map : map,
panel : "results",
autoViewport : true,
selectFirstResult : false
}
});
local.search(scname);
}
}
</script>
</html>