function load(){
var html ="asdasda";
var h2 = "1111111";
var x="124.39812"
var y="40.133399"
var x1;
var y1;//改动处...
var map = new BMap.Map("container");
var point = new BMap.Point(x, y);
map.centerAndZoom(point, 8);
// 编写自定义函数,创建标注
var myIcon = new BMap.Icon("images/car.ico", new BMap.Size(80, 80), {
offset: new BMap.Size(10, 25) // 指定定位位置
//imageOffset: new BMap.Size(0, 0 - 1 * 25) // 设置图片偏移
});
var marker = new BMap.Marker(point, {icon: myIcon});
map.addOverlay(marker);
marker.addEventListener("click", function(){this.openInfoWindow(infoWindow);});
map.addControl(new BMap.NavigationControl()); //向地图添加控件
//movemap
window.setTimeout(function(){
map.panTo(new BMap.Point(x1, y1));
}, 2000);
//add zhexian
var polyline = new BMap.Polyline([
new BMap.Point(x, y),
new BMap.Point(x1, y1)
], {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5});
map.addOverlay(polyline);
var opts = {
width : 250, // 信息窗口宽度
height: 100, // 信息窗口高度
title : "" // 信息窗口标题
}
var infoWindow = new BMap.InfoWindow((html+h2), opts); // 创建信息窗口对象
map.openInfoWindow(infoWindow, map.getCenter()); // 打开信息窗口
}