<!DOCTYPE html>
<html>
<head>
<title>SPIA positions</title>
<style type="text/css">
html,
body,
#basicMap {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<script src="OpenStreetMaps/OpenLayers.js"></script>
<script>
function init() {
map = new OpenLayers.Map("basicMap");
var mapnik = new OpenLayers.Layer.OSM();
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
var position1 = new OpenLayers.LonLat(29.856919813673, 30.6698231962015).transform(fromProjection, toProjection);
//this initial size of the popup appears to be infinite in one dimension
var popup1 = new OpenLayers.Popup("popup1", position1, new OpenLayers.Size("20121210_5"), "20121210_6", false);
var position2 = new OpenLayers.LonLat(29.8555655833635, 30.6691027291649).transform(fromProjection, toProjection);
var popup2 = new OpenLayers.Popup("popup2", position2, new OpenLayers.Size(100, 20), "20121210_7", false);
var position3 = new OpenLayers.LonLat(29.8536289031314, 30.6680431519365).transform(fromProjection, toProjection);
var popup3 = new OpenLayers.Popup("popup3", position3, new OpenLayers.Size(50, 20), "20121210_8", false);
var CenterPosition = new OpenLayers.LonLat(29.8513532832137, 30.6614234181425).transform(fromProjection, toProjection);
var zoom = 16;
map.addLayer(mapnik);
map.setCenter(CenterPosition, zoom);
var markers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(markers);
Marker1 = new OpenLayers.Marker(position1);
Marker1.icon.imageDiv.title = "20121210_6";
markers.addMarker(Marker1);
popup1.updatesize;
map.addPopup(popup1);
Marker2 = new OpenLayers.Marker(position2);
Marker2.icon.imageDiv.title = "20121210_7";
markers.addMarker(Marker2);
popup2.setContentHTML("20121210_5");
//popup2.setSize("20121210_5");
//popup2.autosize =true;
//popup2.maxSize = new OpenLayers.Size(100,20);
popup2.maxSize = new OpenLayers.Size(100, 20);
popup2.setSize(new OpenLayers.Size('20121210_5));
//popup2.updatesize;
//popup2.maxSize = new OpenLayers.Size(100,20);
map.addPopup(popup2); Marker3 = new OpenLayers.Marker(position3); Marker3.icon.imageDiv.title = "20121210_8"; markers.addMarker(Marker3); popup3.autosize = true; popup3.updatesize; map.addPopup(popup3);
}
</script>
</head>
<body onload="init();">
<div id="basicMap"></div>
</body>
</html>
答案 0 :(得分:0)
包装文字 var popup2 = new OpenLayers.Popup(“ popup2”,position2,new OpenLayers.Size('
20121210_5