Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Creating a DOM based Image Rotator


  • From: wdlists at triche-osborne.com (Triche Osborne)
  • Subject: [Javascript] Creating a DOM based Image Rotator
  • Date: Fri Aug 19 08:18:01 2005

Just an afterthought note on this:

> function rotate()
> {
>     if (curDocImg.complete)
>     {
. . .
>     }
> }
> 
If window.onload has not fired yet, curDocImg will have no properties. 
While this prevents the script from executing, it will throw a 
non-material error. A cleaner approach would be to change the if() test 
into something more suitable such as:

if(curDocImg)
or
if(curDocImg != null)

This has the same material effect has the original, but doesn't throw an 
error if window.onload hasn't fired.

Triche