Project

General

Profile

1 3032 perry
<html xmlns="http://www.w3.org/1999/xhtml">
2
  <head>
3
    <style type="text/css">
4
        #map {
5
            width: 512px;
6
            height: 512px;
7
            border: 1px solid black;
8
        }
9
    </style>
10
    <script src="../lib/OpenLayers.js"></script>
11
    <script type="text/javascript">
12
        <!--
13
        box_extents = [
14
            [-10, 50, 5, 60],
15
            [-75, 41, -71, 44],
16
            [-122.6, 37.6, -122.3, 37.9],
17
            [10, 10, 20, 20]
18
        ];
19
20
        function init(){
21
            var map = new OpenLayers.Map('map');
22
23
            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
24
                "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
25
26
            var boxes  = new OpenLayers.Layer.Boxes( "Boxes" );
27
28
            for (var i = 0; i < box_extents.length; i++) {
29
                ext = box_extents[i];
30
                bounds = new OpenLayers.Bounds(ext[0], ext[1], ext[2], ext[3]);
31
                box = new OpenLayers.Marker.Box(bounds);
32
                box.events.register("click", box, function (e) {
33
                    this.setBorder("yellow");
34
                });
35
                boxes.addMarker(box);
36
            }
37
38
            map.addLayers([ol_wms, boxes]);
39
            map.addControl(new OpenLayers.Control.LayerSwitcher());
40
            map.zoomToMaxExtent();
41
        }
42
        // -->
43
    </script>
44
  </head>
45
  <body onload="init()">
46
    <h1>OpenLayers Example</h1>
47
    <div id="map"></div>
48
  </body>
49
</html>