Tags

, , , ,

One of the most interesting IE functions is the document.all.  A colleague of mine once asked me how it is done in Firefox, and at that time I wasn’t aware of the solution.  Just earlier I stumbled upon the answer:

document.getElementsByTagName(‘*’);

Pretty neat, huh?  I didn’t know that wildcards are accepted.  Another approach I picked up while reading source codes around the net is using the JavaScript or operator ("||" without the quotes).  See the example below:

var alltags = document.all || document.getElementsByTagName(‘*’);

If document.all is supported it will be the value of the variable alltags, if not the document.getElementsByTagName will be its value.

More tips and tricks coming up so you may want to watch this space.  Have a nice day!

P.S.
This is actually the first blog I’ve made completely from my ASUS Eee PC!  It’s also the first blog I’ve made through public Wi-Fi!

Advertisements