我想在google地图上实现轨迹代码如下,可是显示不了。应该怎么修改。请指点:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>google地图 ——轨迹</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
function initialize() {
var myOptions = {
zoom: 16,
center: new google.maps.LatLng(39.964556,116.274834),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
// 这里填上轨迹的经纬坐标,
// 坐标做好是在路口的,不然画线不在路上。
var trackPoints = [
new google.maps.LatLng(39.964556,116.274834),
new google.maps.LatLng(39.956662,116.275735),
new google.maps.LatLng(39.957221,116.284447),
new google.maps.LatLng(39.95834,116.29406),
new google.maps.LatLng(39.959326,116.29951),
new google.maps.LatLng(39.960083,116.303029),
new google.maps.LatLng(39.96209,116.307793)
];
var trackPath = new google.maps.Polyline({
path: trackPoints,
strokeColor: "#FF0000", // 线条颜色
strokeOpacity: 1.0, // 线条透明度
strokeWeight: 2 // 线条粗细
}); trackPath.setMap(map);
}</script>
</head>
<body onload="initialize()">
<form id="form1" runat="server">
<div id="map_canvas" style="width:100%; height:100%;"></div>
</form>
</body>
</html>
怎么不显示要达到的预期效果
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>google地图 ——轨迹</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
function initialize() {
var myOptions = {
zoom: 16,
center: new google.maps.LatLng(39.964556,116.274834),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
// 这里填上轨迹的经纬坐标,
// 坐标做好是在路口的,不然画线不在路上。
var trackPoints = [
new google.maps.LatLng(39.964556,116.274834),
new google.maps.LatLng(39.956662,116.275735),
new google.maps.LatLng(39.957221,116.284447),
new google.maps.LatLng(39.95834,116.29406),
new google.maps.LatLng(39.959326,116.29951),
new google.maps.LatLng(39.960083,116.303029),
new google.maps.LatLng(39.96209,116.307793)
];
var trackPath = new google.maps.Polyline({
path: trackPoints,
strokeColor: "#FF0000", // 线条颜色
strokeOpacity: 1.0, // 线条透明度
strokeWeight: 2 // 线条粗细
}); trackPath.setMap(map);
}</script>
</head>
<body onload="initialize()">
<form id="form1" runat="server">
<div id="map_canvas" style="width:100%; height:100%;"></div>
</form>
</body>
</html>
怎么不显示要达到的预期效果
</div>
这一段删了