Return Object By ID


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function returnObjById( id )
  2. {
  3. if (document.getElementById)
  4. var returnVar = document.getElementById(id);
  5. else if (document.all)
  6. var returnVar = document.all[id];
  7. else if (document.layers)
  8. var returnVar = document.layers[id]; return returnVar;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.