Wheelz Posted June 30, 2006 Share Posted June 30, 2006 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 More sharing options...
scott100 Posted June 30, 2006 Share Posted June 30, 2006 Here's the code you need, remember to change the id for each image for this to work. Link to comment Share on other sites More sharing options...
Wheelz Posted June 30, 2006 Author Share Posted June 30, 2006 Here's the code you need, remember to change the id for each image for this to work, also subsitute each image i have put with your own.<{POST_SNAPBACK}> Umm... I think you forgot to post the code?? Link to comment Share on other sites More sharing options...
scott100 Posted June 30, 2006 Share Posted June 30, 2006 Umm... I think you forgot to post the code??<{POST_SNAPBACK}> Sorry, i had to remove it, one of the images didn't work.http://scott100.atspace.com/rollover.htmSo yeah, make sure you give each image an unique id. Link to comment Share on other sites More sharing options...
Wheelz Posted June 30, 2006 Author Share Posted June 30, 2006 http://scott100.atspace.com/rollover.htmSorry to be a pain, but the URL won't load. Link to comment Share on other sites More sharing options...
scott100 Posted June 30, 2006 Share Posted June 30, 2006 http://scott100.atspace.com/rollover.htmSorry to be a pain, but the URL won't load.<{POST_SNAPBACK}> 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 More sharing options...
Chocolate570 Posted June 30, 2006 Share Posted June 30, 2006 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 More sharing options...
scott100 Posted June 30, 2006 Share Posted June 30, 2006 Scott, you gotta get a better host. It's down like, every other day. And what would the forum do without your code? O_ODidn't work for you either This is weird, i have never had any problems viewing my/other sites on atspace.com 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 More sharing options...
ben3001 Posted June 30, 2006 Share Posted June 30, 2006 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<{POST_SNAPBACK}> Hey leave atspace alone lol, i think it is one of thee best free hosts Link to comment Share on other sites More sharing options...
scott100 Posted June 30, 2006 Share Posted June 30, 2006 Hey leave atspace alone lol, i think it is one of thee best free hosts<{POST_SNAPBACK}> 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 More sharing options...
Wheelz Posted July 1, 2006 Author Share Posted July 1, 2006 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://www.lifetothemaxtrust.org.nz/Vision.htmBTW, I can't even ping or tracert that page.Cheers. Link to comment Share on other sites More sharing options...
scott100 Posted July 1, 2006 Share Posted July 1, 2006 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. <{POST_SNAPBACK}> No problem, i'll get shot of that host soon Glad to see you got it working Link to comment Share on other sites More sharing options...
Guest techtonyx Posted July 4, 2006 Share Posted July 4, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now