OpenLayers OpenLayers

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

Revision 3320, 2.6 kB (checked in by tschaub, 1 year ago)

add OpenLayers.Console namespace and a number of methods that allow for logging of error messages - when firebug.js is included in a page, the application runs in "debug" mode - the Firebug extension or Firebug Lite handles OpenLayers.Console calls depending on availability

Line 
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4   <head>
5     <script src="../lib/Firebug/firebug.js"></script>
6     <script src="../lib/OpenLayers.js"></script>
7     <script type="text/javascript">
8         <!--
9         function consoleLog() {
10             OpenLayers.Console.log("This is the result of an OpenLayers.Console.log() call");
11         }
12         function consoleWarn() {
13             OpenLayers.Console.warn("This is the result of an OpenLayers.Console.warn() call");
14         }
15         function consoleError() {
16             OpenLayers.Console.error("This is the result of an OpenLayers.Console.error() call");
17         }
18         function consoleDir() {
19             OpenLayers.Console.dir(OpenLayers);
20         }
21         function consoleDirxml() {
22             OpenLayers.Console.dirxml(document.getElementsByTagName('body')[0]);
23         }
24         // -->
25     </script>
26   </head>
27   <body>
28     <h1>OpenLayers Debug Example</h1>
29     <p>To run OpenLayers in debug mode, include the following script
30     tag <b>before</b> the tag that loads OpenLayers:
31     <pre>
32     &lt;script src="../lib/Firebug/firebug.js"&gt;&lt;/script&gt;
33     </pre>
34     The path to firebug.js must be relative to your
35     html file.  With this script included calls to OpenLayers.Console
36     will be displayed in the Firebug console.  For browsers without
37     the Firebug extension, the script creates a Firebug Lite console.
38     This console can be opened by hitting <b>F12</b> or <b>Ctrl+Shift+L</b>
39     (<b>?+Shift+L</b> on a Mac).  If you want the Firebug Lite console
40     to be open when the page loads, add <b>debug="true"</b> to the opening
41     html tag of your page.  Open the console and click on the links below
42     to see console calls.</p>
43     <ul>
44         <li>
45             <a href="javascript: void(consoleLog());">OpenLayers.Console.log()</a>
46         </li>
47         <li>
48             <a href="javascript: void(consoleWarn());">OpenLayers.Console.warn()</a>
49         </li>
50         <li>
51             <a href="javascript: void(consoleError());">OpenLayers.Console.error()</a>
52         </li>
53         <li>
54             <a href="javascript: void(consoleDir());">OpenLayers.Console.dir()</a>
55         </li>
56         <li>
57             <a href="javascript: void(consoleDirxml());">OpenLayers.Console.dirxml()</a>
58         </li>
59     </ul>
60     <p>The Firebug website has a complete list of
61     <a href="http://www.getfirebug.com/console.html">console calls</a>.
62     Note that not all are supported with Firebug Lite.</p>
63   </body>
64 </html>
Note: See TracBrowser for help on using the browser.