FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
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
Related topics
How to programming javascript in one lines ?
PHP Page
Top Website Design Programs
apply text to multiple html-pages?
Changing internal data with scripting.
Javascript - order of loading
NEW DOMAIN - Best Site on Science!!!
5 February 2010 - Music-Whiz.com - NEW!!!
Free Web Directory
PHP Includes Problem
[IE7] Stylesheet Selection Support
I need a fool-proof anti-source view javascript.
HELP with Javascript!
JavaScript problem in IE7
php / javascript script works in FireFox browser, but not IE
Javascript not working IE6 and IE7
need help: force .pdf file to open in new browser window
external js
JAVASCRIPT FUNCTION- ONCLICK HELP!!
Drag images (Javascript)
PB PHP, Iframe and Javascript
Clock-javascript
Highlighting Table Cells
W00t! Something that finally fixes IE.
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.