主要原因是JSP页面头这句话,去除这句话,地图显示正常:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
地图平移固定在DIV的范围设置语句:
var bounds = new OpenLayers.Bounds(
114.3959455, 34.18611045,
122.0988045, 38.40444655
);///数据以四个浮点型数left, bottom, right, top 的格式存储
var options = {
controls: [],
maxExtent: bounds,
restrictedExtent: bounds,
maxResolution: 0.033995542968750014,
projection: "EPSG:4326",
units: 'degrees'
};
注释掉的这句就是: restrictedExtent: bounds,