I wrote a Javascript page kinda funky and mostly by the seat of my pants,, after hours it works fine on mouseovers in NN3, and not in IE, which I understand is normal..  
My problem... If I begin the script thusly
<SCRIPT LANGUAGE="JavaScript"> it won't work..
if I load it
<SCRIPT="JavaScript"> it loads and works..
it is at
Be happy to send the .txt file of the left pane mouseovers for some technical feller to troubleshoot for me and give me aid and comfort..
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


I looked at your web site and it works very well. Since it is working, what exactly do you want an expert for?
<SCRIPT="JavaScript"> is a syntax error.  Because of that, the tag is being ignored - it's kind of like a double negative - making an error that causes another error to be ignored results in something that works ... if the browser handles errors in a certain way.

The correct Syntax <SCRIPT LANGUAGE="javascript"> doesn't work because it causes the tags in between (all those <A HREF>s) to be read as script rather than HTML.  <SCRIPT> tags need to be used only with actual script (not even handlers embedded inside HTML).  For example ...

     <SCRIPT LANGUAGE="javascript">
     function myFunc(){

Is correct syntax - but if an HTML tag is included, it causes an error, because HTML tags aren't part of the Javascript language.

If a onMouseover tag is included in an HREF, you don't need <SCRIPT> tags.  onMouseover can only be Javascript, doesn't need <SCRIPT> tags, and is ignored by other browsers anyway.

So to clean things up ...

1. Get rid of the <SCRIPT> tags.
2. Close the <HEAD> tag before the <BODY> tag
3. replace <HTTP> and </HTTP> with <HTML> and </HTML>

... and everything will bne both functional and Kosher.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
paulh@cybertrails.comAuthor Commented:
My face is RED for having put the <http> tags.. I'm new, and need some seasoning..
If you have a minute, could you write me a simple JavaScript page for a mouseover.. Using 1.gif as original image and 2.gif as the replace on mouseover. From that, I could, perhaps proceed to learn the correct sintax..
To make sure I understand, the mouseover I use without <SCRIPT> tags is simply an HTML function??
Thanks for your help..PAUL
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

paulh@cybertrails.comAuthor Commented:
A follow up question.. even with the <SCRIPT> tags removed from my page I still get the error from IE when loading..
The page works fine afterward.. Is the error window normal??
Don't worry too much 'bout the error - everyone has their moments (I spent half an hour trying to un-hose a page because I'd used &quot; instead of a real quotation mark inside the BODY tag <g>).

For clarification:

If a javascript command is embedded inside an HTML tag (such as onClick="statement;"), then you don't need the <SCRIPT> tag - only for free-standing script.

On the follow-up ...
Completely normal, and completely unavoidable.

You get errors in IE because IE doesn't understand the images[] array, so mouseOver image "switches" can't be done for IE at all.

To avoid the errors, you need to put in an "if" that tests for Netscape.  I have a pretty snappy mouseOver function that you're free to use.  IE still won't do the image switching, but it won't return errors, either.

Put this in the document <HEAD> (note that the <SCRIPT> tag is used because it's free-standing script)

<SCRIPT LANGUAGE="javascript">
     function switchout (position,filename){
             if((navigator.appName == "Netscape") && (navigator.appVersion.substring(0,1) > 2)){
             document.images[position].src='gifs/' + filename + '.gif'

You may need to alter the location of the .src unless your art is stored in a "gifs" folder on the same level as the page.

Then, for each image, do this (no <SCRIPT> tags) ...

<A HREF="document.html"
     <IMG SRC="gifs/is.gif" BORDER="0"></A>

The two values passed (0,is) are for the position of the image and the name of the GIF to "switch" the present one with.  In this example, onMouseover places gifs/isi.gif over images[0]; onMouseout re-places gifs/is.gif (the original image when the page was loaded) over images[0]

paulh@cybertrails.comAuthor Commented:
I'm so new to the JavaScript, that I guess it's not getting through.. I'm quite comfortable with html, but not getting through on Java..Could you do this for me...
the above script, could you write it "exactly" as I need to put it on a page, including the exact script for the browser check, if I have my html page and my .gif files stored in a common folder, and my .gif file is named
gif1.gif  and on mouseover it is to be replaced by  gif2.gif

I know I'm a bother, but if I can get one exact script and study it, I hope to get up and running... Thanks for all of your help, and your suggestions worked exactly as you indicated..
No problem ... if I'm reding you right, all .html and .gif are in the same folder.  That'll take some adjustments - I'll also make a minor change to account for the fact that I don't know where the image will appear in the page ...

inside the <HEAD> tags, add this ...

<SCRIPT LANGUAGE="javascript">
<!-- hide
function switchout (position,filename){
    if((navigator.appName == "Netscape") &&
    (navigator.appVersion.substring(0,1) > 2)){
    document.bob.src=+ filename + '.gif'
// unhide -->

In the <BODY> where you want the image to appear, add these tags ...

<A HREF="document.html" onMouseover="switchout(0,'gif2')"
onMouseout="switchout(0,'gif1')"> <IMG SRC="gifs/gif1.gif" NAME="bob" BORDER="0"></A>

This will only work for the one image, though, because the function works with the image name ("bob") - the previous example used position in the images[] array, but ince I don't know what position the image is in, I gave it a name.

If you need to switch-out a second image, put NAME="fred" in the IMG tag and change the script line from "document.bob.src = [etc]" to document.fred.src = [etc])
paulh@cybertrails.comAuthor Commented:
Took out the + sign on the document.bob.src line and the application worked ..
Was unable to get a second pair of images to switch out using this example or the other one.. guess I'm just too thick to savvy.
When I use this script, does not the image return to '0', always place the same image on the return. So if I want to use several switchouts on same page.. as on my page, can it be done with this
example?? I named the gifs.. gif1, gif2, gif3, gif4, etc...
So if I want gif1 to appear on top, then on mouse over switch to gif2 and back on mouseout.. Then I want gif3 to appear on second position, and switchout to gif4 on mouseover and back on mouseout, etc. etc..
Wish I understood just what each line in the script was telling the browser..
I realize I'm a bother, but hoping to be able to understand this one function and then hoping to be able to branch out from there..
Have read quite a bit on JavaScript, but it's slow sinking in..
Thanks again..PAUL
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.