If you have been working your way through these tutorials (whether as a beginner or as someone looking to update their JavaScript knowledge so as to use a more modern coding approach) then you should have a fairly good idea of how it all fits together by now. You should now be in a position where you know how to write your scripts so that the are unobtrusive (so that there is no JavaScript whatever in the HTML and the page works even without the JavaScript) and so that it works properly in all modern browsers that support the appropriate functionality while degrading gracefully in older browsers that don't.
There is one last thing that I want to cover in this tutorial series though and that is to run through some of the pieces of JavaScript code that were commonly used in the past and which are now completely inappropriate to use in modern scripts. Identifying these constructs will not only tell you how not to code things in your new scripts but will also help you in identifying those things that you need to update in a script that is already written in order to modernise it.
- Since you will not have any JavaScript at all in your HTML it's somewhat redundant to remind you that JavaScript within HTML has not needed to be enclosed within an HTML comment for well over 10 years now. I also don't need to remind you that there shouldn't be any "attributes" in any of the tags in your page that start with 'on'.
- Since our JavaScript will run after the elements that it is to access we will be using DOM commands or innerHTML to update our page and document.write() will never appear in our code anywhere.
- document.layer is a proprietary DOM for Netscape 4 which we'd only need to use if we wanted to support that antique browser. The same applies to document.all which is a proprietary DOM for Internet Explorer 4. IE5 and later support the standard DOM commands and so you don't need to use the proprietary one unless you also need to support IE4.
- alert() will be used only for debugging purposes and will not appear in a live page and confirm() and prompt() will not be used at all.
- Browser sensing will never appear in your scripts in an attempt to distinguish between those browsers which do support what you want from those that don't. You'll use feature sensing instead.
- While not mentioned previously, you should also avoid using eval and with in your code as they are extremely inefficient in how they work and there is always a more efficient alternative.
More of This Tutorial
- 1 Hello World
- 2 Events
- 3 Visitor Triggered Events
- 4 Timed Events
- 5 Testing Conditions
- 6 Feature Sensing
- 7 Alternate Tag Location
- 8 Functions and Methods
- 9 Passing Parameters
- 10 Variables/Properties
- 11 Objects
- 12 Arrays
- 13 Nodelists
- 14 Loops
- 15 Numbers
- 16 Strings
- 17 Dates
- 18 Alert
- 19 Other Objects
- 20 Extending Objects
- 21 Creating Objects
- 22 Collision Proofing
- 23 JavaScript and Forms
- 24 Updating the Web Page

