Posted By


sarfraznawaz2005 on 02/11/09

Tagged


Statistics


Viewed 534 times
Favorited by 0 user(s)

Truely getElementById


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

cross-browser document.getElementById, should be on top of code.


Copy this code and paste it in your HTML
  1. // cross-browser document.getElementById, should be on top of code.
  2. if(!document.getElementById)
  3. {
  4. if(document.all)
  5. document.getElementById=function()
  6. {
  7. if(typeof document.all[arguments[0]]!="undefined")
  8. return document.all[arguments[0]]
  9. else
  10. return null
  11. }
  12. else if(document.layers)
  13. document.getElementById=function()
  14. {
  15. if(typeof document[arguments[0]]!="undefined")
  16. return document[arguments[0]]
  17. else
  18. return null
  19. }
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.