FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

External JavaScript and IE7

 


dayveday
Hopefully someone can help with the problem I'm having.

I have a webpage I'm working on - just the skeleton of a full page. It only has the top heading and basic menu underneath it. I'm using javascript to make the images in the menu change when you move the mouse over it. I had the javascript inline in the page within the <script> and it worked well in both IE7 and Firefox.

Because I want to reuse the menu on many pages, I copied the javascript exactly out and put it in file script/roll.js, and replaced the script declaration with <script type="text/javascript" src="script/roll.js"/>

Now, when I try to view the page in IE7 nothing at all shows up - the page is blank. But it still works perfectly in Firefox.

Any clues?!

(the page is at www.cakeinyourface.com/work.html if you'd like to see more)
qscomputing
I had this exact problem with my site. It's because IE doesn't understand the self-closing tag (ie <script ... />) - it thinks you mean that tag without the closing slash. For images this is fine because it interprets it as an old-style img tag, ignoring the slash, but for scripts it means that IE regards your entire page from the script tag down as being part of the script. So, the solution is to do this:
<script ... src="..."></script>

HTH.
DoctorBeaver
Ah, that solves a nagging little problem that I had too. Thanks Smile
dayveday
Thanks for that - working perfectly now.

I thought IE7 was finally starting to get standards compliant - obviously MS still running their own agenda! I'll keep my eye out for that trick in the future.

Cheers
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.