add code to Map.js to allow for the addittion and removal of popups. add a new html file to play around with popups. add a test in the test_Map file for the popup adding/removing

git-svn-id: http://svn.openlayers.org/trunk/openlayers@227 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-21 15:47:10 +00:00
parent b5c6bbbf20
commit d9762c984e
3 changed files with 114 additions and 0 deletions

46
popups.html Normal file
View File

@@ -0,0 +1,46 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map, layer, popup;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://octo.metacarta.com/cgi-bin/mapserv",
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'} );
map.addLayer(layer);
popup = new OpenLayers.Popup("chicken",
new OpenLayers.Pixel(20,240),
new OpenLayers.Size(500,100)
);
map.addPopup(popup);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
function away() {
map.removePopup(popup);
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Example</h1>
<div id="map"></div>
<div style="background-color:blue" onclick="away()"> hello</div>
</body>
</html>