![]() |
Javascript and image rollovers
Hi all, im sure everyone and his cat knows how to do image rollovers, my problem is I want to dynaimcally change the name of the image I am changing, as I will be changing multiple images depending on where the users mouse is on the screen, just cant get my head around the code to make this work.. here is what i have done so far (it doesnt work).
<script=javascript> arr_Number = ImageNumber.split("x"); document.all.xAxis.innerHTML = arr_Number[0]; document.all.yAxis.innerHTML = arr_Number[1]; ImgSourceName = "im" & arr_Number[0] & "x" & arr_Number[1] ImgSourceName.src = "images/glassblockmouseover.jpg"; //document.write(arr_Number[0]); //document.write(arr_Number[1]); //alert('hello'); </script> HTML for onew image is below. <a href="glassinteractive.php?acc=1&down=1" onMouseOut="ImageChangerRestore()" onMouseOver="ImageChanger('1x1')"><img name="im1x1" src="images/glassblock.jpg" width="28" height="28" border="0"></a> Hope this makes sense.. |
Re: Javascript and image rollovers
tehe I sorted it myself by swapping
ImgSourceName.src = "images/glassblockmouseover.jpg"; for document.images[ImgSourceName].src = "images/glassblockmouseover.jpg"; Cheers :) |
Re: Javascript and image rollovers
http://www.alistapart.com/articles/sprites/
I was going to suggest this as an alternative The examples http://www.alistapart.com/d/sprites/ala-image3.html http://www.alistapart.com/d/sprites/ala-blobs2.html No preloading, and works even when javascript is disabled |
Re: Javascript and image rollovers
What Matth said. :tu:
I was going to suggest going the CSS route myself. |
Re: Javascript and image rollovers
Hey, im a bit old fashioned, so some css tricks would be good!
I basically, have a 15x15 wall that as your mouse goes over, the corresponding down and up bricks need to be highlited. A bit like words table building with the blue blocks. I know have everything working, apart from reversing the selection, so any input is really appreciated! Many thanks Andy |
Re: Javascript and image rollovers
Can i just say thanks 4 the links... they proving intersting and probably how I want to play things
Thanks |
| All times are GMT. The time now is 01:43. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum