/ Published in: JavaScript
This will get the document's body in a very agreeable manner - it returns the first div on the page if there is no body (hey it can happen).
Adapted from code by Scott Schiller
Adapted from code by Scott Schiller
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
getDocument: function() { return(document.body?document.body:(document.documentElement?document.documentElement:document.getElementsByTagName('div')[0])); },