Web Analytics Made Easy -
StatCounter make text appear when mouseover hotspot - CodingForum

Announcement

Collapse
No announcement yet.

make text appear when mouseover hotspot

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • make text appear when mouseover hotspot

    hi there again

    right, I have a row of 8 thumbnails.

    now when the mouse goes over each I want a description of the thumbnail to appear to the right of the set of thumbnails.

    Ive seen it done in quite a few sites...

    but I havent got the foggiest

    can anybody help with writing the code

    thanks

    Masten

  • #2
    Use the title attribute in your img tags.

    .....Willy

    Comment


    • #3
      Somthing like this?

      Code:
      <html>
      <head>
      <script type="text\javascript">
      
      function imageInfo(info)
      {
      	infoSpot.innerHTML=info;
      }
      
      </script>
      </head>
      <body>
      <img src="image0" onmouseover="imageInfo('Descripton for Image 0');" onmouseout="infoSpot.innerHTML='';">
      <img src="image1" onmouseover="imageInfo('Descripton for Image 1');" onmouseout="infoSpot.innerHTML='';">
      <img src="image2" onmouseover="imageInfo('Descripton for Image 2');" onmouseout="infoSpot.innerHTML='';">
      <img src="image3" onmouseover="imageInfo('Descripton for Image 3');" onmouseout="infoSpot.innerHTML='';">
      <img src="image4" onmouseover="imageInfo('Descripton for Image 4');" onmouseout="infoSpot.innerHTML='';">
      <div id="infoSpot">
      </div>
      </body>
      </html>
      Basscyst
      Helping to build a bigger box. - Adam Matthews

      Comment


      • #4
        basscyst,

        I figured it out by msyelf in the end though using some pre-built behaviours, though I did manage to modify it to work better using your code ...

        so thanks for the help

        Masten

        Comment


        • #5
          Hi everyone,

          Sorry to revive an old thread, but I just used this script (by Basscyst) on my site and it works great in internet explorer 6.0, but doesn't seem to show up (the text upon mousing over the images) in Netscape 7.1.

          Does Netscape require some different sort of declaration of the script type?



          Thanks again for any help!

          Comment


          • #6
            The reference to the infoSpot div is incorrect which IE tolerates.

            Change the reference to

            document.getElementByid("infoSpot")

            The onmouseout can also be modified to

            <img src="image0" onmouseover="imageInfo('Descripton for Image 0');" onmouseout="imageinfo('');">
            Glenn
            vBulletin Mods That Rock!

            Comment


            • #7
              Thanks Glenngv,

              Without checking I'm willing to bet that's why a number of my scripts don't work in other browsers. At work I only have to code for IE so I guess I've picked up some bad habits.

              Thanks,

              Basscyst
              Helping to build a bigger box. - Adam Matthews

              Comment


              • #8
                Hrrm.. I'm still having a problem getting it to work properly for some reason.


                <font size=-1><a href="http://www.deepdarksea.com/snesintroduction.htm"><img BORDER="0" target="C"; ONCLICK='parent.B.location="snesleft.htm"'; src="http://www.deepdarksea.com/controllerpage.gif" onmouseover="imageInfo('Use genuine Nintendo or Super Nintendo controllers on your PC! Click the picture to visit the SNES adapter page, where you can purchase an adapter or get more information.');" onmouseout="infoSpot.innerHTML='';"></a></font>


                Would I replace imageinfo('blah blah blah') with
                document.getElementByid("infoSpot")('blah blah blah')

                Sorry to be a little dense with this - I'm still quite new to javascript stuff. Can you post an example of the corrected code?

                Comment


                • #9
                  Just change

                  onmouseout="infoSpot.innerHTML='';"

                  to

                  onmouseout="imageInfo('');"
                  Glenn
                  vBulletin Mods That Rock!

                  Comment

                  Working...
                  X