Iwanna Learn Java Script

Overview

Learning JavaScript generally means learning to script a page in a WebBrowser. JavaScript is also used for programming MozillaXul applications. And JavaScripts can run stand-alone like VisualBasic scripts and DOS batch files in MicrosoftWindows. IwannaLearnJavaScript assumes you will be scripting web pages.

Learning to script web pages with JavaScript involves learning not only the JavaScript language itself but the objects that comprise the browser page and and other browser elements, plus the browser's event handling mechanism.


Online:

Documentation: Language: Articles & Tutorials: Some Wiki pages:
Books:

Newer to older JavaScript: A Programmer's Companion from Basics through DHTML, CSS and DOM is great for total beginners. JavaScript: The Definitive Guide will teach you the details of the language. It's kind of dated, though, and doesn't veer from the core language and objects. -- This was a judgement on the previous, fourth edition, so probably needs updating. JavaScript: The Complete Reference also teaches the details of the language. It's new enough and farther from the core to introduce AjaxWebApplications and processing RssFeeds. DHTML Utopia assumes you're already familiar with JavaScript. It presents loads of whiz-bang cookbook uses, including an entire section on Ajax. Most books, especially older ones, only teach for various versions of InternetExplorer and NetscapeNavigator. This book assumes DOM-compliance (IE6, MozillaFirefox, SafariBrowser, etc.) and points out glitches when scripting the less-popular browsers.


Tools:

Download and install MozillaFirefox or the full-blown MozillaBrowser. Why? Because its "JavaScript Console" and "DOM Inspector" are invaluable. The JavaScript Console keeps a log of error messages, and the DOM Inspector lets you (duh!) inspect and navigate the DocumentObjectModel of any web page. Keep in mind that although modern browsers all have pretty much the same DOM, a web page in a Mozilla browser will have a lot more Text nodes than in InternetExplorer. The Mozilla browsers consider whitespace, such as newlines, between HTML tags to be text while InternetExplorer ignores it. I'm not sure how other browsers handle this, but InternetExplorer is, as usual, "non-standard."

Mozilla's JavaScript Console helps you track and find errors while using a MozillaBrowser, but what about other browsers? Be sure set your InternetExplorer preferences to pop up JavaScript error messages. You won't get a nice running log, however. (Does M$'s DotNet developer environment provide good JavaScript/JScript development tools?) I have a boatload of objections to the SafariBrowser, one of which is, I can't for the life of me figure out how to get it to display JavaScript errors. Maybe it can't. Safari feels like black box. I know nothing about OperaBrowser and many other browsers.

Safari has a Debug menu from which you can turn on a JavaScript console, log exceptions to the Console, and evaluate html snippets (including <script> blocks). Turn on the Debug menu by executing this line from the Terminal:
 defaults write com.apple.Safari IncludeDebugMenu 1

For a JavaScript error logger that should work in several browsers (not just the Mozilla family), see http://www.alistapart.com/articles/jslogging. I haven't tried it but it looks promising.

I recommend doing your JavaScript development work in a Mozilla-family browser (if only for its tools) and--because of the ~90% of users who are MicrosoftSlaves--InternetExplorer 6, then testing your work in as many other browsers as you can.


Validation:

You might be into validating your HTML/XHTML (http://validator.w3.org/). Watch out, though. The JavaScript examples in many books and tutorials begin with a tag that looks something like <script type="text/javascript" language="Javascript1.5">. But the language attribute is deprecated; it's not valid when using the strict HTML or XHTML doctype. Unless you can come up with a really good reason to insist on a numbered version of JavaScript, you might as well leave off the language attribute.


Breaking News:

MozillaFirefox 1.5 is in beta release. Its JavaScript Array object supports some FunctionalProgramming methods (http://simon.incutio.com/archive/2005/09/11/firefox15). The JS 1.5 documentation makes it appear that these methods are standard in JS 1.5, which has been around ever since NetscapeNavigator 6. Yet another page of documentation claims these methods are new in JS 1.6 (http://developer.mozilla.org/en/docs/New_in_JavaScript_1.6). In any case, I'm not aware of any other browser which supports these nifty methods.

InternetExplorer 7 is in beta release. I'm under the impression it uses the same JavaScript event model and Event object as IE6, and I doubt it supports the FunctionalProgramming Array methods of JavaScript 1.6. Anybody know? Anybody care to research?


CategoryJavaScript IwannaLearn

I would like to learn about how viewers of my website can post on my website. Does anyone know if there is code that is already out there?

EditText of this page (last edited February 18, 2008) or FindPage with title or text search