<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=JavaScript_DHTML%2FDevelopment%2FDebug</id>
		<title>JavaScript DHTML/Development/Debug - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=JavaScript_DHTML%2FDevelopment%2FDebug"/>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=JavaScript_DHTML/Development/Debug&amp;action=history"/>
		<updated>2026-04-05T05:56:59Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wbex.ru/index.php?title=JavaScript_DHTML/Development/Debug&amp;diff=1834&amp;oldid=prev</id>
		<title> в 10:02, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=JavaScript_DHTML/Development/Debug&amp;diff=1834&amp;oldid=prev"/>
				<updated>2010-05-26T10:02:39Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 10:02, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://wbex.ru/index.php?title=JavaScript_DHTML/Development/Debug&amp;diff=1835&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=JavaScript_DHTML/Development/Debug&amp;diff=1835&amp;oldid=prev"/>
				<updated>2010-05-26T07:19:59Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Debug function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Examples From&lt;br /&gt;
JavaScript: The Definitive Guide, Fourth Edition&lt;br /&gt;
Legal matters: these files were created by David Flanagan, and are&lt;br /&gt;
Copyright (c) 2001 by David Flanagan.  You may use, study, modify, and&lt;br /&gt;
distribute them for any purpose.  Please note that these examples are&lt;br /&gt;
provided &amp;quot;as-is&amp;quot; and come with no warranty of any kind.&lt;br /&gt;
David Flanagan&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
var _console = null;&lt;br /&gt;
function debug(msg) &lt;br /&gt;
{&lt;br /&gt;
    // Open a window the first time we are called, or after an existing&lt;br /&gt;
    // console window has been closed.&lt;br /&gt;
    if ((_console == null) || (_console.closed)) { &lt;br /&gt;
        _console = window.open(&amp;quot;&amp;quot;,&amp;quot;console&amp;quot;,&amp;quot;width=600,height=300,resizable&amp;quot;);&lt;br /&gt;
        // Open a document in the window to display plain text.&lt;br /&gt;
        _console.document.open(&amp;quot;text/plain&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    _console.focus();                 // Make the window visible&lt;br /&gt;
    _console.document.writeln(msg);   // Output the message to it&lt;br /&gt;
    // Note that we purposely do not call close().  By leaving the&lt;br /&gt;
    // document open we are able to append to it later.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;!-- Here&amp;quot;s an example of using this script. --&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;var n = 0;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;form&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Push Me&amp;quot;&lt;br /&gt;
       onclick=&amp;quot;debug(&amp;quot;You have pushed me:\t&amp;quot; + ++n + &amp;quot; times.&amp;quot;);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==debug function displays plain-text debugging messages==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Examples From&lt;br /&gt;
JavaScript: The Definitive Guide, Fourth Edition&lt;br /&gt;
Legal matters: these files were created by David Flanagan, and are&lt;br /&gt;
Copyright (c) 2001 by David Flanagan.  You may use, study, modify, and&lt;br /&gt;
distribute them for any purpose.  Please note that these examples are&lt;br /&gt;
provided &amp;quot;as-is&amp;quot; and come with no warranty of any kind.&lt;br /&gt;
David Flanagan&lt;br /&gt;
*/&lt;br /&gt;
/**&lt;br /&gt;
 * This debug function displays plain-text debugging messages in a&lt;br /&gt;
 * special box at the end of a document.  It is a useful alternative&lt;br /&gt;
 * to using alert() to display debugging messages.&lt;br /&gt;
 **/&lt;br /&gt;
function debug(msg) {&lt;br /&gt;
    // If we haven&amp;quot;t already created a box within which to display&lt;br /&gt;
    // our debugging messages, then do so now.  Note that to avoid&lt;br /&gt;
    // using another global variable, we store the box node as a property&lt;br /&gt;
    // of this function.&lt;br /&gt;
    if (!debug.box) {&lt;br /&gt;
        // Create a new &amp;lt;div&amp;gt; element&lt;br /&gt;
        debug.box = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;
        // Specify what it looks like using CSS style attributes&lt;br /&gt;
        debug.box.setAttribute(&amp;quot;style&amp;quot;, &lt;br /&gt;
                               &amp;quot;background-color: white; &amp;quot; +&lt;br /&gt;
                               &amp;quot;font-family: monospace; &amp;quot; +&lt;br /&gt;
                               &amp;quot;border: solid black 3px; &amp;quot; +&lt;br /&gt;
                               &amp;quot;padding: 10px;&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
        // And append our new &amp;lt;div&amp;gt; element to the end of the document&lt;br /&gt;
        document.body.appendChild(debug.box);&lt;br /&gt;
        // Now add a title to our &amp;lt;div&amp;gt;.  Note that the innerHTML property is&lt;br /&gt;
        // used to parse a fragment of HTML and insert it into the document.&lt;br /&gt;
        // innerHTML is not part of the W3C DOM standard, but it is supported&lt;br /&gt;
        // by Netscape 6 and Internet Explorer 4 and later.  We can avoid &lt;br /&gt;
        // the use of innerHTML by explicitly creating the &amp;lt;h1&amp;gt; element,&lt;br /&gt;
        // setting its style attribute, adding a Text node to it, and &lt;br /&gt;
        // inserting it into the document, but this is a nice shortcut&lt;br /&gt;
        debug.box.innerHTML =&lt;br /&gt;
            &amp;quot;&amp;lt;h1 style=&amp;quot;text-align:center&amp;quot;&amp;gt;Debugging Output&amp;lt;/h1&amp;gt;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    // When we get here, debug.box refers to a &amp;lt;div&amp;gt; element into which&lt;br /&gt;
    // we can insert our debugging message.&lt;br /&gt;
    // First, create a &amp;lt;p&amp;gt; node to hold the message&lt;br /&gt;
    var p = document.createElement(&amp;quot;p&amp;quot;);&lt;br /&gt;
    // Now create a text node containing the message, and add it to the &amp;lt;p&amp;gt;&lt;br /&gt;
    p.appendChild(document.createTextNode(msg));&lt;br /&gt;
    // And append the &amp;lt;p&amp;gt; node to the &amp;lt;div&amp;gt; that holds the debugging output&lt;br /&gt;
    debug.box.appendChild(p);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Debugging Using alert() Methods &amp;quot;html&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
var myVariable;&lt;br /&gt;
var yourVariable;&lt;br /&gt;
   &lt;br /&gt;
function setType()&lt;br /&gt;
{&lt;br /&gt;
  alert(&amp;quot;Inside the setType function.&amp;quot;);  //Debug statement&lt;br /&gt;
  return(yourVariable=&amp;quot;truck&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
function setColor()&lt;br /&gt;
{&lt;br /&gt;
  alert(&amp;quot;Inside the setColor function.&amp;quot;);  //Debug statement&lt;br /&gt;
  return(myVariable=&amp;quot;blue&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
//Debug statement&lt;br /&gt;
alert(&amp;quot;Before if statement: type=&amp;quot;+yourVariable+&amp;quot; color=&amp;quot;+myVariable);&lt;br /&gt;
   &lt;br /&gt;
if(setType() || setColor())&lt;br /&gt;
{&lt;br /&gt;
  //Debug statement&lt;br /&gt;
  alert(&amp;quot;After if statement: type=&amp;quot;+yourVariable+&amp;quot; color=&amp;quot;+myVariable);&lt;br /&gt;
  document.write(&amp;quot;The &amp;quot; + yourVariable + &amp;quot; is &amp;quot; + myVariable);&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
  alert(&amp;quot;The vehicles could not be set&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handle error==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
Examples From&lt;br /&gt;
JavaScript: The Definitive Guide, Fourth Edition&lt;br /&gt;
Legal matters: these files were created by David Flanagan, and are&lt;br /&gt;
Copyright (c) 2001 by David Flanagan.  You may use, study, modify, and&lt;br /&gt;
distribute them for any purpose.  Please note that these examples are&lt;br /&gt;
provided &amp;quot;as-is&amp;quot; and come with no warranty of any kind.&lt;br /&gt;
David Flanagan&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
// A variable we use to ensure that each error window we create is unique.&lt;br /&gt;
var error_count = 0;&lt;br /&gt;
// Set this variable to your email address.&lt;br /&gt;
var email = &amp;quot;myname@mydomain.ru&amp;quot;;&lt;br /&gt;
// Define the error handler. It generates an HTML form so&lt;br /&gt;
// the user can report the error to the author.&lt;br /&gt;
function report_error(msg, url, line)&lt;br /&gt;
{&lt;br /&gt;
   var w = window.open(&amp;quot;&amp;quot;,                    // URL (none specified)&lt;br /&gt;
                       &amp;quot;error&amp;quot;+error_count++, // Name (force it to be unique)&lt;br /&gt;
                       &amp;quot;resizable,status,width=625,height=400&amp;quot;); // Features&lt;br /&gt;
   // Get the document object of the new window.&lt;br /&gt;
   var d = w.document;    &lt;br /&gt;
   // Output an HTML document, including a form, into the new window.&lt;br /&gt;
   // Note that we omit the optional call to Document.open()&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;font size=&amp;quot;7&amp;quot; face=&amp;quot;helvetica&amp;quot;&amp;gt;&amp;lt;b&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;OOPS.... A JavaScript Error Has Occurred!&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&amp;lt;hr size=&amp;quot;4&amp;quot; width=&amp;quot;80%&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;form action=&amp;quot;mailto:&amp;quot; + email + &amp;quot;&amp;quot; method=post&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot; enctype=&amp;quot;text/plain&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;font size=&amp;quot;3&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;i&amp;gt;Click the &amp;quot;Report Error&amp;quot; button to send a bug report.&amp;lt;/i&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Report Error&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Dismiss&amp;quot; onclick=&amp;quot;self.close();&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;/div&amp;gt;&amp;lt;div align=&amp;quot;right&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;br&amp;gt;Your name &amp;lt;i&amp;gt;(optional)&amp;lt;/i&amp;gt;: &amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;input size=&amp;quot;42&amp;quot; name=&amp;quot;name&amp;quot; value=&amp;quot;&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;br&amp;gt;Error Message: &amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;input size=&amp;quot;42&amp;quot; name=&amp;quot;message&amp;quot; value=&amp;quot;&amp;quot; + msg + &amp;quot;&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;br&amp;gt;Document: &amp;lt;input size=&amp;quot;42&amp;quot; name=&amp;quot;url&amp;quot; value=&amp;quot;&amp;quot; + url + &amp;quot;&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;br&amp;gt;Line Number: &amp;lt;input size=&amp;quot;42&amp;quot; name=&amp;quot;line&amp;quot; value=&amp;quot;&amp;quot;+line +&amp;quot;&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;br&amp;gt;Browser Version: &amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;input size=&amp;quot;42&amp;quot; name=&amp;quot;version&amp;quot; value=&amp;quot;&amp;quot;+navigator.userAgent+&amp;quot;&amp;quot;&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;/div&amp;gt;&amp;lt;/font&amp;gt;&amp;quot;);&lt;br /&gt;
   d.write(&amp;quot;&amp;lt;/form&amp;gt;&amp;quot;);&lt;br /&gt;
   // Remember to close the document when we&amp;quot;re done.&lt;br /&gt;
   d.close();&lt;br /&gt;
   // Return true from this error handler, so that JavaScript does not&lt;br /&gt;
   // display its own error dialog.&lt;br /&gt;
   return true;&lt;br /&gt;
}&lt;br /&gt;
// Before the event handler can take effect, we have to register it&lt;br /&gt;
// for a particular window.&lt;br /&gt;
self.onerror = report_error;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
// The following line of code purposely causes an error as a test.&lt;br /&gt;
alert(no_such_variable);&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>