OpenLayers OpenLayers

root/branches/openlayers/2.5/examples/getfeatureinfo.html

Revision 4246, 1.9 kB (checked in by euzuro, 1 year ago)

use the namespace corrected event.stop(). (See #880)

  • Property svn:eol-style set to native
Line 
1 <html>
2 <head>
3 <script src="../lib/OpenLayers.js"></script>
4 <style type="text/css">
5 ul, li { padding-left: 0px; margin-left: 0px; }
6 </style>
7 <title>World Map Query</title> 
8 </head>
9 <body>
10   <a id='permalink' href="">Permalink</a><br />
11   <div style="float:right;width:28%">
12     <h1 style="font-size:1.3em;">CIA Factbook</h1>
13     <p style='font-size:.8em;'>Click a country to see statistics about the country below.</p>
14     <div id="nodeList">
15     </div>
16   </div>
17   <div id="map" style="width:70%; height:90%"></div>
18   <script defer="defer" type="text/javascript">
19     OpenLayers.ProxyHost = "/dev/examples/proxy.cgi?url=";
20     var map = new OpenLayers.Map('map', {'maxResolution':'auto'});
21    
22     var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
23         "http://world.freemap.in/cgi-bin/mapserv?map=/www/freemap.in/world/map/factbook.map", {'layers': 'factbook'} );
24     map.addLayer(wms);
25     map.addControl(new OpenLayers.Control.Permalink('permalink'));
26     map.zoomToMaxExtent();
27     map.events.register('click', map, function (e) {
28             OpenLayers.Util.getElement('nodeList').innerHTML = "Loading... please wait...";
29             var url =  wms.getFullRequestString({
30                             REQUEST: "GetFeatureInfo",
31                             EXCEPTIONS: "application/vnd.ogc.se_xml",
32                             BBOX: wms.map.getExtent().toBBOX(),
33                             X: e.xy.x,
34                             Y: e.xy.y,
35                             INFO_FORMAT: 'text/html',
36                             QUERY_LAYERS: wms.params.LAYERS,
37                             WIDTH: wms.map.size.w,
38                             HEIGHT: wms.map.size.h});
39             OpenLayers.loadURL(url, '', this, setHTML);
40             OpenLayers.Event.stop(e);
41       });
42     function setHTML(response) {
43         OpenLayers.Util.getElement('nodeList').innerHTML = response.responseText;
44     }
45   </script>
46 </body>
47 </html>
Note: See TracBrowser for help on using the browser.