Results 1 to 2 of 2

Thread: help: mouse over an image changes text in specified table

  1. #1
    Join Date
    Jul 2005
    Location
    UK
    Posts
    159
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default help: mouse over an image changes text in specified table

    i've seen it done before and now that i want to do it myself, i've forgotten where i might leach the code...

    i'm making a menu for a website, i'd like for a caption to change depending on which menu button the user hovers over. so, when the page loads, a caption below the menu will say "welcome to blah blah blah" and when the user hovers over a "vendors" button, the caption will change to "locate a distributor or buy from our online store".... and so on.

    any ideas would be appreciated

    _moscarda

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    HTML Code:
    <script type="text/javascript">
    var vendordesc = "Locate a distributor or buy from our online store.";
    // ... insert more descriptions ... (HTML will work, but it must be valid.  Escape quotes.)
    function recaption(string) {
    document.getElementById("caption").innerHTML = string;
    }
    </script>
    
    <img src="..." onmouseover="recaption(vendordesc);" alt="Vendors"/>
    <!-- ... more menu items ... -->
    
    <p id="caption">Welcome to blah blah blah.  Mouse over the items for a description.</p>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •