changing pictures...trouble...

Biggie_mac

OSNN Junior Addict
Joined
16 Feb 2005
Messages
18
I am having a problem with a "picture swap". I want to place a small picture which changes to another picture when you place the mouse over. i've tried the hover button from frontpage but it takes 5-6 sec until the buttons can be seen(there are 7 of'em). I've tried this:

<img src="poze/produse.jpg" height="21" width="160" border="1" name="picture2"
onmouseover ="document.picture2.src = 'poze/produse2.jpg' "
onmouseout ="document.picture2.src = 'poze/produse.jpg' "</a></a><p style="margin-top: 0; margin-bottom: 0" align="center">

but it either doesn't work or I have to hold the mouse over for 5-6 sec for the picture to change...who can give me some hints regarding this problem?
 
heheh still the wrong forum :D you want coding and design but anyway :p

IIRC you need to specify its javascript somehow... but dontquote me on that.
 
Code:
<img src="poze/produse.jpg" border="1" id="picture2" 
onmouseover="document.getElementById('picture2').src='poze/produse2.jpg';" 
onmouseout="document.getElementById('picture2').src='poze/produse.jpg';" />


See it in action: http://www.albybum.net/temp/osnn/

Any lag time in the image rollover working could be due to the size of the image.
 
Teaching someone to use the fully qualified method, ie getElementByID(), will give them the ability to change other images and more importantly other elements outside the scope of the current element.

Using 'this' keyword is valid and very handy when you want to avoid ID attributes, but I like to make sure people get the detailed example. :)
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back