Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text change on image rollover?

    I am doing a simple javascript rollover where an image in the left part of the page changes based on the image rolled over in the right part of the page. I would also like to have a small text description appear below the image on the left based on which image on the right is being rolled over. Can anyone point me in the right direction?

    Thanks,
    Nicole

  • #2
    Regular Coder
    Join Date
    Dec 2003
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sure,

    Code:
    <html>
    <head>
    <title>Page</title>
    <script language=javascript>
    
    function changeImgAndDiscription(discription,img){
       window.document.getElementById("changing_text").innerHTML=""+
       discription+"";
    
       window.document.the_image.src=img;
    }
    
    </script>
    </head>
    <body>
    
    <img src="the_image.gif" name="the_image">
    <p id="changing_text">Here is the discription</p>
    
    <img src="img1.gif" onMouseOver="changeImgAndDiscription(
    'this is image 1','img1.gif');">
    <img src="img2.gif">
    <img src="img3.gif">
    
    </body>
    </html>
    That would do it...
    UNDER CONSTRUCTION

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Works beautifully!! Thanks so much!


  •  

    Posting Permissions

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