silu/创旅丝路/resources/ihchina/map/index.html

362 lines
7.2 KiB
HTML
Raw Normal View History

2025-10-14 00:45:23 +08:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>旅游景点行程安排</title>
<style>
/* Reset CSS */
html {
_text-overflow: ellipsis;
}
body {
color: #333;
font-size: 12px;
}
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
code,
form,
fieldset,
legend,
input,
button,
textarea,
p,
blockquote,
th,
td {
margin: 0;
padding: 0;
}
fieldset,
img {
border: 0;
}
address,
caption,
cite,
code,
dfn,
em,
th,
var,
optgroup {
font-style: inherit;
font-weight: inherit;
}
del,
ins {
text-decoration: none;
}
li {
list-style: none;
}
caption,
th {
text-align: left;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 100%;
font-weight: normal;
}
q:before,
q:after {
content: '';
}
abbr,
acronym {
border: 0;
font-variant: normal;
}
sup {
vertical-align: baseline;
}
sub {
vertical-align: baseline;
}
legend {
color: #000;
}
input,
button,
textarea,
select,
optgroup,
option {
font-family: inherit;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
}
input,
button,
textarea,
select {
*font-size: 100%;
}
b,
em,
i,
s,
u {
font-weight: normal;
font-size: 12px;
font-style: normal;
text-decoration: none;
}
a {
color: #2076b2;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
.clearfix {
display: block;
}
* html .clearfix {
height: 1%;
}
/* Custom Styles */
.map_container {
padding: 20px;
background: #fff;
min-width: 920px;
}
.map_breadnav {
font-family: "微软雅黑";
font-size: 14px;
color: #333;
margin-bottom: 15px;
}
.map_mapwarp {
width: 100%;
float: left;
}
.mm_inner {
margin-left: 370px;
height: 768px;
}
#allmap {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
font-family: "微软雅黑";
}
.map_formwarp {
float: left;
width: 350px;
height: 768px;
margin-left: -100%;
overflow: auto;
}
.mf_list .it {
width: 100%;
float: left;
padding-bottom: 15px;
}
.mf_list .pb3 {
padding-bottom: 3px;
}
.it_label {
float: left;
width: 60px;
height: 5px;
font-family: "微软雅黑";
font-size: 14px;
color: #333;
line-height: 25px;
margin-right: 10px;
}
.it_input,
.it_textarea,
.it_select {
float: left;
width: 150px;
height: 15px;
line-height: 15px;
background: #fff;
border: 1px solid #ccc;
padding: 5px;
margin-right: 10px;
}
.it_input:focus,
.it_textarea:focus,
.it_select:focus {
outline: none;
}
.it_searbtn {
float: left;
width: 70px;
height: 27px;
}
.it_tips {
font-family: "微软雅黑";
font-size: 12px;
color: #333;
}
</style>
</head>
<body>
<div class="map_container">
<div class="clearfix">
<div class="map_mapwarp">
<div class="mm_inner">
<div id="allmap"></div>
</div>
</div>
<div class="map_formwarp">
<div class="map_breadnav">查询城市名-&gt;显示景点-&gt;公交查询</div>
<ul class="mf_list clearfix">
<li class="it clearfix">
<label class="it_label">城市名:</label>
<input type="text" class="it_input" id="cityName" />
<input type="button" class="it_searbtn" value="查询" onclick="theLocation()" />
</li>
<li class="it clearfix">
<label class="it_label">景点名:</label>
<textarea class="it_textarea" id="jdname"></textarea>
<input type="button" class="it_searbtn" value="显示景点" onclick="map.clearOverlays();index = 0;document.getElementById('jdnameNone').value='';bdGEO();" />
</li>
<li class="it pb3 clearfix">
<label class="it_label">无法查询到的景点:</label>
<textarea class="it_textarea" id="jdnameNone"></textarea>
</li>
<li class="it clearfix">
<label class="it_label"></label>
<p class="it_tips">无法查询景点请使用详细地址或周边替代地址查询</p>
</li>
<li class="it clearfix">
<label class="it_label">交通查询:</label>
<select class="it_select" id="cfjd"></select>
</li>
<li class="it clearfix">
<label class="it_label"></label>
<select class="it_select" id="ddjd"></select>
</li>
<li class="it clearfix">
<label class="it_label"></label>
<select id="cx_type">
<option value="1">公交</option>
<option value="2">步行</option>
<option value="3">驾车</option>
</select>
</li>
<li class="it clearfix">
<label class="it_label"></label>
<input type="button" class="it_searbtn" value="查询交通" onclick="jtcx()" />
<br /><br />
<div id="r-result"></div>
</li>
</ul>
</div>
</div>
</div>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=eGFcuxWH8WXksA6F3xhhlwdi"></script>
<script type="text/javascript">
var cfjd = document.getElementById('cfjd');
var ddjd = document.getElementById('ddjd');
var map = new BMap.Map("allmap");
var point = new BMap.Point(114.180375, 22.301244);
map.centerAndZoom(point, 15);
map.enableScrollWheelZoom(true);
var myGeo = new BMap.Geocoder();
function theLocation() {
var city = document.getElementById("cityName").value;
if (city != "") {
map.centerAndZoom(city, 15);
}
}
var index = 0;
function bdGEO() {
jdTmp = document.getElementById("jdname").value;
adds = jdTmp.split("\n")
var add = adds[index];
geocodeSearch(add);
index++;
}
function geocodeSearch(add) {
if (index < adds.length) {
setTimeout(window.bdGEO, 400);
}
if (add) {
myGeo.getPoint(add, function (point) {
if (point) {
var address = new BMap.Point(point.lng, point.lat);
addMarker(address, new BMap.Label(index + ":" + add, { offset: new BMap.Size(0, 0) }));
cfjd.options.add(new Option(add, add));
ddjd.options.add(new Option(add, add));
} else {
document.getElementById("jdnameNone").value += index + "." + add + "\n";
}
}, document.getElementById("cityName").value);
}
}
function addMarker(point, label) {
var marker = new BMap.Marker(point);
map.addOverlay(marker);
marker.setLabel(label);
}
var transit = new BMap.TransitRoute(map, { renderOptions: { map: map, panel: "r-result", autoViewport: true } });
var walking = new BMap.WalkingRoute(map, { renderOptions: { map: map, panel: "r-result", autoViewport: true } });
var driving = new BMap.DrivingRoute(map, { renderOptions: { map: map, panel: "r-result", autoViewport: true } });
function jtcx() {
cx_type = document.getElementById("cx_type").value;
if (cx_type == 1) {
walking.clearResults();
driving.clearResults();
transit.search(cfjd.value, ddjd.value);
}
if (cx_type == 2) {
transit.clearResults();
driving.clearResults();
walking.search(cfjd.value, ddjd.value);
}
if (cx_type == 3) {
transit.clearResults();
walking.clearResults();
driving.search(cfjd.value, ddjd.value);
}
}
</script>
</body>
</html>