Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runtime error in IE

Status
Not open for further replies.

futilemonk

Technical User
Apr 26, 2006
20
US
hello,

I use an image rollover script that has worked fine on other sites, but it gives me a runtime error "image-x is undefined" in IE here:


rollover the words in the navigation and the picture should change each time. It works fine in firefox.

PLEASE HELP!!

-thanks
 
You're getting errors in firefox as well - open up the javascript console and you'll see them. Any reason you don't just code your own image rollover script? That way you don't have to sift thru lines of someone else's code, and they aren't too hard to code. If you need assistance with it post back here.

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
thanks kaht,

yes, the reason is i have not taken the time to learn javascript.

wow there are alot of errors. if there are errors, then why does it seem to work in firefox?

 
then why does it seem to work in firefox

To be honest, the behavior was a bit choppy for me in firefox. Sometimes when I'd hover over a picture it wouldn't change every time. It's hard telling why. Here's a really quick and simple script to do image rollovers - although if you're going to continue using javascript you should really learn the language:
Code:
<script type="text/javascript">

function changeImage(imageName) {
   document.getElementById("theImage").src = imageName;
}

</script>

<a href="[URL unfurl="true"]http://www.google.com"[/URL] [blue]onmouseover="changeImage('image1.jpg')"[/blue] [red]onmouseout="changeImage('default.jpg')"[/red]>Hover over me for image 1</a>
<a href="[URL unfurl="true"]http://www.google.com"[/URL] [blue]onmouseover="changeImage('image2.jpg')"[/blue] [red]onmouseout="changeImage('default.jpg')"[/red]>Hover over me for image 2</a>
<img src="default.jpg" id="theImage" />

As you can see, when each anchor is hovered over, it calls a function to change the src of the image to a new image. When the mouse moves off the anchor it calls the onmouseout function which changes the image back to the default picture. Pretty simple, you should be able to implement this easily.

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
Wow!

that is alot more simple, thanks a million!

I plan to learn javascript soon, working with these scripts help me understand some of it.
 
I took a quick look at your page, when your mouse moves off the links you're not changing it back to a default image. For that reason, there's not really a need to have an onmouseout function at all on the links - so you can remove them completely.

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top