I am using jquery_and_timers.js. But when i try to run my webpage. It gives following error:
Line: 16
Error: ‘body’ is null or not an object
Here is the error line:
return Math.max(f.documentElement["client" + c], f.body["scroll" + c], f.documentElement["scroll" + c], f.body["offset" + c], f.documentElement["offset" + c])
Can anyone tell how to fix this?
** I think this is where it is happening:
I call a method
loadIframe() from $(document).ready(function () {...
function loadIFrame() {
$("#toggleStyle").attr("href", "style/la.css");
$('#Src').insertBefore('#togg');
$("#inf").attr("src", "images/inf.png");
}
It is when this method loadIframe is called it gives that error.
There’s really not enough code in your question, but since the error is about
body, and not aboutdocumentElement, I’m guessingfisdocument, and you’re running the code before the DOM is ready.You can run the code after the DOM is ready by placing it in a handler passed to jQuery’s
.ready()method.Or if in spite of the jQuery tag you’re not using jQuery, just place your script just before the closing
</body>tag…