关于使用JavaScript调用Google Maps实现线路查询的问题。请高手帮忙找一下错误。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.
<html xmlns="http://www. xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>Google Maps JavaScript API Example: Simple Directions</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="http://maps.
type="text/javascript"></script>
<script type="text/javascript" language="javascript" >
var map;
var directionsPanel;
var directions;
function initialize() {
var x1="北京"
var y1="上海"
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(42.351505,-71.094455), 15);
directionsPanel = document.getElementById("route");
directions = new GDirections(map, directionsPanel);
directions.load("from: x to: y ") 路线查询时为什么这样的代码不能实现道路查询,把x、y用北京、南京等具体值代替就可以实现。这是怎么回事,我想把路线查询的地址赋给两个变量,通过给变量赋值实现路线查询。请高手指点一下。
//document.write(x)
//document.write("<br>")
//document.write(y)
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width: 70%; height: 480px; float:left; border: 1px solid black;"></div>
<div id="route" style="width: 25%; height:480px; float:right; border; 1px solid black;"></div>
<br/>
</body>
</html>