A problem with mouseover buttons

Discussion in 'CSS' started by mightyb, Apr 4, 2006.

  1. #1
    I use this code and it works well

    <a href= "http://www.google.com" onMouseOver= "if (document.images) document.button3.src= 'http://www.pu55y.be/templates/skidoo_too/images/button4.gif';" onMouseOut= "if (document.images) document.button3.src= 'http://www.pu55y.be/templates/skidoo_too/images/button3.gif';"><img src= "http://www.pu55y.be/templates/skidoo_too/images/button3.gif" name="button3" border=0></a>
    PHP:
    Only for one button however. The second i add another button using the same or different images it stops working. Any ideas guys? May be there is another way of doing this? Thanks!
     
    mightyb, Apr 4, 2006 IP
  2. Slapyo

    Slapyo Well-Known Member

    Messages:
    266
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    This should work, as long as you have a different name for each IMG tag and you reference the correct one.
    <a href= "http://www.google.com" onMouseOver= "if (document.images) document.button3.src= 'http://www.pu55y.be/templates/skidoo_too/images/button4.gif';" onMouseOut= "if (document.images) document.button3.src= 'http://www.pu55y.be/templates/skidoo_too/images/button3.gif';"><img src= "http://www.pu55y.be/templates/skidoo_too/images/button3.gif" name="button3" border=0></a>
    <a href= "http://www.google.com" onMouseOver= "if (document.images) document.button4.src= 'http://www.pu55y.be/templates/skidoo_too/images/button5.gif';" onMouseOut= "if (document.images) document.button4.src= 'http://www.pu55y.be/templates/skidoo_too/images/button4.gif';"><img src= "http://www.pu55y.be/templates/skidoo_too/images/button4.gif" name="button4" border=0></a>
    Code (markup):
     
    Slapyo, Apr 4, 2006 IP
    mightyb likes this.
  3. mightyb

    mightyb Banned

    Messages:
    6,566
    Likes Received:
    405
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Oh yea! Thanks! I did change the name but only the one at the end. Missed the document.button4.src=

    Works fine now :D
     
    mightyb, Apr 4, 2006 IP