SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question how to change the alt on rollover

    Hi.

    I have an image with a link and on click it's changed for another image. I want to know if I could change the alt when the new image is on.

    Thank you.

  2. #2
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried after setting the new image then doing the_image.alt = "blah"? I have not tried that, but it would seem like the logical answer.
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Possibility.

    Guess? Yes I have had tried but I do not understand, I don't know how to do it...
    HTML Code:
     <a href="#"><img src="../imagens/mais.gif" alt="Bla Bla" name="mais" width="16" height="15" border="0" id="mais" onMouseDown="swapImage('mais','','../imagens/menos.gif',1)"></a>
    «menos.gif» is the second image.

    Can you help me?

  4. #4
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, this works.

    Code:
    <img src="../imagens/mais.gif" alt="Blah" onMouseOver="this.src='../imagens/menos.gif'; this.alt='Different Blah'" onMouseOut="this.src='../imagens/mais.gif'; this.alt='Blah';" />
    edit: wait, you want to change the image when it is clicked? Do you want to change it back also somehow? To change it on click:

    Code:
    <img src="../imagens/mais.gif" alt="Blah" onClick="this.src='../imagens/menos.gif'; this.alt='Different Blah';" />
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  5. #5
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    Thank you!!

  6. #6
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure thing
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  7. #7
    SitePoint Evangelist SpaceFrog's Avatar
    Join Date
    Jan 2005
    Location
    Outerspace
    Posts
    511
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    be careful alt is for alternative ... use title="Bla bla ..." instead ...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •