Forum Moderators: open

Message Too Old, No Replies

Rollover Error in Moz/Firefox

Illegal Character in Japanese?

         

Horse Feathers

8:23 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



My rollover script is running fine in IE and Opera, but doesn't seem to function in Mozilla or FireFox. When I looked at the JavaScript Console for these browsers, it lists the following:

Error: illegal character
Source File: file:///C:/[...]/menu.js Line 1
[Instert Japanese characters here]?[more Japanese]
[green arrow]

-------------------------
Error: aboutOver is not defined

-------------------------
Error: aboutOut is not defined

-------------------------
[and so on...]

What am I missing here?

Bernard Marx

8:35 pm on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think we need to see the statement(s) that cause this.

Can you post the function involved?

Horse Feathers

10:30 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



The external file:
if (document.images) {
homeOver = new Image
homeOut = new Image

aboutOver = new Image
aboutOut = new Image

photosOver = new Image
photosOut = new Image

shopOver = new Image
shopOut = new Image

bookOver = new Image
bookOut = new Image

homeOver.src = "graphics/menu/homelime.gif"
homeOut.src = "graphics/menu/homemage.gif"

aboutOver.src = "graphics/menu/aboutlime.gif"
aboutOut.src = "graphics/menu/aboutmage.gif"

photosOver.src = "graphics/menu/photoslime.gif"
photosOut.src = "graphics/menu/photosmage.gif"

shopOver.src = "graphics/menu/shoplime.gif"
shopOut.src = "graphics/menu/shopmage.gif"

bookOver.src = "graphics/menu/booklime.gif"
bookOut.src = "graphics/menu/bookmage.gif"

}
else {
homeOver = ""
homeOut = ""
document.home = ""

aboutOver = ""
aboutOut = ""
document.about = ""

photosOver = ""
photosOut = ""
document.photos = ""

shopOver = ""
shopOut = ""
document.shop = ""

bookOver = ""
bookOut = ""
document.book = ""

}

and the script in the document:

<A HREF="index.html" onMouseover="document.home.src=homeOver.src" onMouseout="document.home.src=homeOut.src"><IMG SRC="graphics/menu/homemage.gif" WIDTH="92" HEIGHT="32" BORDER="0" NAME="home" ALT="Home"></A>
<A HREF="about.html" onMouseover="document.about.src=aboutOver.src" onMouseout="document.about.src=aboutOut.src"><IMG SRC="graphics/menu/aboutmage.gif" WIDTH="92" HEIGHT="32" BORDER="0" NAME="about" ALT="About Us"></A>
<A HREF="photos.html" onMouseover="document.photos.src=photosOver.src" onMouseout="document.photos.src=photosOut.src"><IMG SRC="graphics/menu/photosmage.gif" WIDTH="92" HEIGHT="32" BORDER="0" NAME="photos" ALT="Photos"></A>
<A HREF="shop.html" onMouseover="document.shop.src=shopOver.src" onMouseout="document.shop.src=shopOut.src"><IMG SRC="graphics/menu/shopmage.gif" WIDTH="92" HEIGHT="32" BORDER="0" NAME="shop" ALT="Shop"></A>
<A HREF="booking.html" onMouseover="document.book.src=bookOver.src" onMouseout="document.book.src=bookOut.src"><IMG SRC="graphics/menu/bookmage.gif" WIDTH="92" HEIGHT="32" BORDER="0" NAME="book" ALT="Booking"></a>

I've used this exact script before with no problems. Am I missing a typo? And again, why the Japanese?

adni18

1:32 pm on Jan 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



new Image

Undoubtedly, this should have either empty parenthesis, or the width and height of the image in parenthesis.

new Image(23,124)

Horse Feathers

10:47 pm on Jan 12, 2005 (gmt 0)

10+ Year Member



Whether it does or doesn't didn't seem to affect the script last time I used it, nor does it make a difference now. I.e.: I put the image sizes in, and it still doesn't work.

Why Japanese?

Horse Feathers

7:06 am on Jan 13, 2005 (gmt 0)

10+ Year Member



Well, I still don't know why Japanese was showing up in the JavaScript Consoles of Mozilla and FireFox, but I did fix what was wrong:

I had saved the html document as a unicode document instead of a text file. IE and Opera didn't mind, so I didn't even think to check it... oops.

Thanks for the help, guys, but it was a user end problem. :)