Jump to content

Multiple Mouseover Images


Wheelz

Recommended Posts

Hi,I'm new to this forum and to javascript.I managed to successfully run the mouseover code provided by W3Schools, thank you.My problem comes when I try to apply it to multiple images. I believe the problem lies in the script in the <head> section. How do I punctuate the 2 instances?http://homepages.maxnet.co.nz/wheelz/LTTM/mouseover.htmThe real page has 5 images to run. I tried another long winded method but that didn't work either and was even harder to fault-find.Any help appreciated.

Link to comment
Share on other sites

http://scott100.atspace.com/rollover.htmSorry to be a pain, but the URL won't load.

Your kidding :) Here's the code from the page :)
<html><head><script type="text/javascript">function mover(id,img){document.getElementById(id).src=img;}function mout(id,img){document.getElementById(id).src=img;}</script></head><body><img id="img1" src="1.gif" onmouseover="mover(this.id,'2.GIF')" onmouseout="mout(this.id,'1.gif')" /><img id="img2" src="3.gif" onmouseover="mover(this.id,'4.gif')" onmouseout="mout(this.id,'3.gif')" /><img id="img3" src="5.gif" onmouseover="mover(this.id,'6.gif')" onmouseout="mout(this.id,'5.gif')" /></body>

Link to comment
Share on other sites

Scott, you gotta get a better host. It's down like, every other day. And what would the forum do without your code? O_O

Link to comment
Share on other sites

Scott, you gotta get a better host. It's down like, every other day. And what would the forum do without your code? O_O
Didn't work for you either :) This is weird, i have never had any problems viewing my/other sites on atspace.com :blink: Anyway, atspace is only temporary, i just started it up as somewhere to keep live working demos for peep's to see, rather than posting lenghty code and saying "change this bit to yours" etc.After i get back my summer hols i'm going to get a paid host, i was checking out your recommendation - webhostingbuzz.com - i'm sure i can stretch to $3 a month (geez that's only £1.65 for me :) less than renting a dvd for 3 days :) )
Link to comment
Share on other sites

Hey leave atspace alone lol, i think it is one of thee best free hosts

lol it was after helping you out a couple months back that i decided to create an account with them :) maybe it's only stable for folks in UK :)
Link to comment
Share on other sites

Scott,Thanks a lot for the code. I know it's a simple thing for you but being a newbie I struggled with the format for quite a while, lol.http://homepages.maxnet.co.nz/wheelz/LTTM/Vision.htmBTW, I can't even ping or tracert that page.Cheers.  :)

No problem, i'll get shot of that host soon :) Glad to see you got it working :)
Link to comment
Share on other sites

Guest techtonyx

This code sort of fixes my problem also...Thanx scott100!!The only addition I want to make to my site is that I want to have a "down" or "selected" image stay visible once a button/image has been clicked and the mouse has been moved off the button. Is this possible?What code do I need to add (and where) to achieve this? Below is the code I am using currently if you need it. Cheers!

<html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><head><script type="text/javascript">function mover(id,img){document.getElementById(id).src=img;}function mout(id,img){document.getElementById(id).src=img;}function mdown(id,img){document.getElementById(id).src=img;}function mup(id,img){document.getElementById(id).src=img;}</script></head><body>img id="img1" src="images/home_button.gif" width="68" height="88" onMouseOver="mover(this.id,'images/home_button-over.gif')" onMouseOut="mout(this.id,'images/home_button.gif')" onMouseDown="mdown(this.id,'images/home_button-down.gif')" onMouseUp="mup(this.id,'images/home_button-sel.gif')" />img id="img2" src="images/artists_button.gif" onMouseOver="mover(this.id,'images/artists_button-over.gif')" onMouseOut="mout(this.id,'images/artists_button.gif')" onMouseDown="mdown(this.id,'images/artists_button-down.gif')" onMouseUp="mup(this.id,'images/artists_button-sel.gif')"/>img id="img3" src="5.gif" onMouseOver="mover(this.id,'6.gif')" onMouseOut="mout(this.id,'5.gif')" /></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...