What we are going to do here is to take a fully functional script that I wrote some years ago and an equivalent script that I wrote recently and analyse the differences between them.
- Falling Snow
The new completely unobtrusive version of this script (you can download the original for comparison).
- Accessing The DOM
Since I wrote the first version of the falling snow script in 2004 the standard DOM has been implemented in all browsers and no one uses IE4 or Netscape 4 any more.
- Accessing The BOM
- Defining Variables And Starting The Script
Best practice on how to define your variables and on where to attach scripts to a web page has changed over the years.
- document.write And The DOM
- setTimeout and setInterval
You see poorly coded setTimeout statements in so many scripts that it can take a while to realise that you are not coding your setTimeout the most efficient way and that in many instances a setInterval may be more appropriate.
- Redo From Start - Calendar Script
As my calendar script had been patched and changed over an eight year period and hadn't been updated for three years I decided it was time to start over and write a brand new version. The new version is far more flexible and contains far more functionality in less code than the old script.
- Holidays and Not Today
New functionality is easier to add when you have a more modern script to start with.
- Calendar Buttons
Although the new script is far more flexible than the old, it still needs a bit more code to allow it to be used the same way as the old script.
- Holiday Function
By making the method polymorphic (so it can accept different data types) we make it even more flexible.
- Modal Dialogs
- Modal Dialogs in Loops
In revisiting a script to modernise it you often find that you can provide additional information on ways to use the script.
- Modal Dialogs in Sequential Code
- Dynamic Dropdown Boxes - Revised
It isn't only big scripts that can benefit from being rewritten. Here I have rewritten the code for processing dynamic dropdowns to make it easier to modify and far more flexible using a lot less code than the original.
- More Dynamic Dropdown Boxes - Revised
The new version of this script can easily be expanded to handle three or more dropdowns - here's how.
We now have Package Deals to create and maintain your website for you.
(includes special prices for community groups and hobby clubs)