View Full Version : JavaScript "Object" Error Preventing Page from Displaying Properly?

09-26-2012, 04:50 PM
I have been working on a web site at http://olomcc.org and for the most part it is rendered properly but for some reason when viewing with IE 8 from work it does not. I believe it is due to four separate JavaScript functions called from an external js file but I cannot seem to figure out the problem. The functions simply use the 'document.write' method to add some HTML to the document; nothing fancy. I've attached a screenshot of the faulty rendering as well as a screenshot of the scripting errors using IE's debugging feature.

I am quite new to scripting and have read many articles to no avail.

Thank you.

09-26-2012, 05:09 PM
well, the first thing is that IE 8 on my machine renders the page fine - nothing like your screenshot.

the second thing is that document.write() is very obsolete and it is worth investigating another way to do this.

the third is that you have html commenting within your document.write statement. Document write is javascript, so it could be that this is confusing the code. Have a look here, from your headingtoplev1 function:

document.write("<a class='mainlink' href='index.html'>HOME</a> <strong>|</strong> <a class='mainlink' href='http://olomcc.org/wordpress/' target='_blank'>BLOG</a> <strong>|</strong> <a class='mainlink' href='http://olomcc.org/phpbb3/' target='_blank'>FORUMS</a> <strong>|</strong> <a class='mainlink' href='http://ex.myhosting.com/owa/' target='_blank'>WEBMAIL</a> <strong>|</strong> <a class='mainlink' href='http://m.olomcc.org' target='_self'>MOBILE</a> <!-- <strong> | </strong> <a class='mainlink' href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HH6JDEH97EYJN' target='_blank'>ONLINE TIDE</a>-->")

everything between the <!-- and the --> (the ONLINE TIDE link) is commented out , so it will never get rendered anyway. You are basically saying to the js "make this part of the page" and then later, to the html "ignore this bit". I would suggest removing all of that and seeing if the situation improves