// WebWoman's Wisdom - JavaScript
// Copyright 2003 Tina Spain McDuffie.  All rights reserved.

var tips = new Array()
tips[0] = "Use the JavaScript Console in Netscape Navigator to test expressions.  To open the console, type <code>javascript:</code> in the location bar."

tips[1] = "The JavaScript Console built into Netscape Navigator can be a handy debugging tool.  It will identify the line number where an error was encountered "
tips[1] += "so you can get to the root of the problem quickly.  The associated error message is often rather too vague, but can at least give you an idea of what to look for."

tips[2] = "When scripting for an audience that uses older browsers, <i>embed</i> all scripts. "
tips[2] += "Netscape 2 does not support external JavaScripts."

tips[3] = "Use object detection instead of browser detection.  For example: "
tips[3] += "<pre>if (document.images) {<br>   \/\/<i>do this if images supported</i><br>"
tips[3] += "} else {<br>   \/\/<i>do this if images object is not supported</i><br>}</pre>"
tips[3] += "The condition evaluates to true if the object is supported by the browser and false if it is not.  "
tips[3] += "With this technique you don\'t have to keep track of what each browser supports."

tips[4] = "Did you know?  Netscape\'s original name for Client-Side JavaScript was <i>LiveScript</i>."

tips[5] = "Watch those apostrophes!  We\'re so used to using them, it\'s easy to forget that they\'re special characters to JavaScript. "
tips[5] += "They\'re used to delimit strings.  To use an apostrophe, also known as a single quote, simply type a backslash before the culprint to escape its special JavaScript meaning.<br>"
tips[5] += "Example: <code>\\\'</code>."

tips[6] = "Did you know? JavaScript is an object-based scripting language developed by Netscape Communications for the express purpose of making Web pages more dynamic and interactive."

tips[7] = "Did you know?  Dynamic HTML (DHTML) isn\'t a language itself.  It\'s really a combination of technologies: HyperText Markup Language (HTML), Cascading Style Sheets (CSS), JavaScript, and the Document Object Model (DOM)."

tips[8] = "JavaScript is a wonderful tool for client-side form validation.  Running client-side, on the visitor's own computer, the form validation "
tips[8] += "routine can execute and respond faster than an equivalent server-side program.  Simply not having to talk to the server makes for a big boost "
tips[8] += "in performance, not to mention that it reduces the server\'s overall workload, too."

tips[9] = "Did you know?  JavaScript is not a sublanguage of Java.  It is often confused with Java because of their similar names and similar syntax. "
tips[9] += "Both were modeled after C++, which explains the latter.  Netscape licensed the Java part of JavaScript's name from Sun Microsystems.  Java "
tips[9] += "was becoming quite popular at the time."

tips[10] = "For a variety of articles on Web development topics, free scripting examples and more, visit <a href=\"http://www.webwoman.biz/\" target=\"_blank\">WebWoman</a> at <a href=\"http://www.webwoman.biz/\" target=\"_blank\">www.webwoman.biz</a>!"

tips[11] = "Use JavaScript to validate a form, but back it up with a server-side validator, such as a CGI script. "
tips[11] += "That way, if the visitor\'s browser doesn\'t support JavaScript, the form still gets validated.  If the "
tips[11] += "visitor\'s browser <i>does</i> support JavaScript, that\'s one less form validation the server had to perform. "
tips[11] += "You\'ve thus lightened its load."

tips[12] = "A History Note.  JavaScript was created by Brendan Eich of Netscape Communications and first released in 1995 as part of Netscape Navigator 2.0."

tips[13] = "Did you know?  There are three flavors of JavaScript: Core JavaScript, Client-Side JavaScript, and Server-Side JavaScript. "
tips[13] += "Core JavaScript defines the basic JavaScript language including its operators, control structures, built-in functions, etc. "
tips[13] += "Client-Sice JavaScript extends the JavaScript Core to provide access to browser and Web document objects via the document object model (DOM). "
tips[13] += "Server-Side JavaScript runs on a JavaScript-enable Web server and is used to provide access to databases, files, and the like."

tips[14] = "Did you know?  The original ECAMAScript, ECMA-262, was based on Netscape\'s Core JavaScript 1.1."

tips[15] = "Did you know?  The event model was originally a Netscape extension to HTML incorporated in the Netscape Navigator 2.0 Web browser. "
tips[15] += "It has since been incorporated into the HTML 4.0 specification where it is called \"intrinsic events\"."	

tips[16] = "Use JavaScript to validate a form, but back it up with a call to a CGI script form validator. "
tips[16] += "That way, if the visitor\'s browser doesn\'t support JavaScript, then the form data still gets validated by the CGI script. "

tips[17] = "<code>document</code> is a property of the <code>window</code> object.  Its formal dot notation is <code>window.document</code>. "
tips[17] += "However, JavaScript assumes when you use the shorthand, <code>document</code>, that you are referring to the current window. "
tips[17] += "Using the shorthand saves a lot of typing, but keep in mind that there are times when it is critical to specify the window formally. "
tips[17] += "See Chapter 11 of <i>JavaScript Concepts &amp; Techniques: Programming Interactive Web Sites</i> for details."

tips[18] = "<code>alert</code> is a method of the <code>window</code> object.  It takes a single string parameter representing the text you want to display in the alert box. "
tips[18] += "Technically, its formal reference is <code><i>window</i>.alert(\"<i>Some Text</i>\")</code>. "
tips[18] += "JavaScript assumes you want to use the current window, so <i>most</i> of the time you can leave off the window designation."

tips[19] = "Notepad can be very useful for removing special characters and formatting that is invisible to the naked eye.  "
tips[19] += "Simply open the Web document that you suspect has a hidden character in Notepad, and save it. "
tips[19] += "Notepad will remove any special characters or formatting contained in the document."

tips[20] = "To view the source code of an external JavaScript file: <ul>"
tips[21] += "<li>View the HTML document\'s source.</li><li>Note the path to the external JavaScript file in the src attribute of the &lt;script&gt; tag "
tips[21] += "usually found in the &lt;head&gt; of the document.</li><li>Modify the current URL in your location bar to point to the path and file you "
tips[21] += "from the src attribute.</li><li>Some browsers may require you to add the JavaScript MIME type before allowing you to view the .js file in your "
tips[21] += "browser. If prompted to choose an application to open the file with, choose Notepad, WordPad, or your favorite HTML editor.</li>"
tips[21] += "<li>You can also get the file from your cache.  Look for a file with a .js extension.</li></ul>"

tips[22] = "You cannot use parseInt() to turn a floating-point number into an integer.  Neither can you use parseFloat() to turn an integer into a floating-point number. "
tips[22] += "parseInt() and parseFloat() only work on <i>strings</i>. Their purpose is to convert strings to numbers."

tips[23] = "Not sure what data type a variable or object property is?  You can use the typeof operator to determine it.<br>"
tips[23] += "Syntax: <code>typeof (<i>operand</i>)</code> or <code>typeof <i>operand</i></code>"

tips[24] = "Should you try to perform mathematical operations on strings, other than + and +=, which are legitimate string operators, "
tips[24] += "JavaScript will attempt to convert the strings into numbers before performing the operation.  If the conversions are successful, "
tips[24] += "the result is a number.  If not, the result is NaN."

tips[25] = "You could be really nice to your visitors, when you\'re using pop-up windows: use a cookie and provide your visitors the option "
tips[25] += "of turning the pop ups off for this visit and future visits to your site."

tips[26] = "One common mistake many programmers make is to try to write an onSubmit event handler within a submit button's tag instead of in the &lt;form&gt; tag. "
tips[26] += "One way to keep it straight in your mind is to remember that you submit <em>forms</em>, not <em>submit buttons</em>."

tips[27] = "The onChange event handler can be used to perform calculations and/or to validate a form field's contents whenever its value changes."

tips[28] = "Whenever you write a control structure, immediately write the closing brace after writing the opening brace. "
tips[28] += "Then go back and enter the contents of the control structure.  That way, you\'ll rarely have to hassle with syntax "
tips[28] += "errors having to do with mismatched braces."

tips[29] = "Did you know?  The naming of loop counters and array subscripts as i, j, k, l, m, and n hearkens back to the early days of Fortran. "
tips[29] += "In Fortran, variables whose names begin with letters I through N were by default integers, the rest were floats."

tips[30] = "You can use a for loop to print the entire contents of an array.  For that matter, you can perform just about any operation on every element in an array using a for loop."

