getElementById Cross Browser

Description Javascript

xGetElementById is a cross-browser version of document.getElementById

The Code Download

  1. function xGetElementById(e) {
  2.     if(typeof(e)!='string') return e;
  3.     if(document.getElementById) e=document.getElementById(e);
  4.     else if(document.all) e=document.all[e];
  5.     else e=null;
  6.     return e;
  7. }


Added by JC on 11th November 2007


There are no comments about this snippet.

Post Comment Github Markdown Supported

You must be logged in to post a comment.

Login here to post a comment