Recent Articles

Viewing Coding Category
7
Dec
2006

JS Function I live By…


Written By: Bart
I wanted to share this with everyone as it's a function I would not be able to develop without... every project I start this is the first function I put into my code...
function obj(el) {
     if( document.all ) {
          return document.all(el);
     } else {
          return document.getElementById(el);
     };
};
Basically what it allows me to do it is reference any object the in DOM by using the following...
obj('divid').style.backgroundColor = 'red';
It works in IE & FF and all other browsers, I've been using it for years now and can't live without it :) Have fun with it.






   
| All Contents Copyright © 2008