Can I do this with javascript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jbu311
    New Member
    • Jun 2006
    • 2

    Can I do this with javascript?

    Let's say I split my website into two halves. The left half is text, and the right side is an image. I know I can get onmouseover effects in javascript, but is there way to have it so that when a user rolls his mouse over the image on the right, to make text appear on the left side of the webpage? If it can't be done, is there another way to do it in javascript?

    Thanks in advance,
    jbu
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Yes.


    Oh you wanted a bit more than that? :D

    If you have a div (with and id of say Text) on the left and an image on the right then when you mouse over an image in the mouse of handler you can have code similar to

    Code:
    document.getElementById('Text').innerHTML = "This is the text for the image";
    You may also be able to do something with image maps.

    Comment

    • jbu311
      New Member
      • Jun 2006
      • 2

      #3
      thanks

      thanks, that was exactly what i needed

      Comment

      • udaypawar
        New Member
        • Feb 2007
        • 29

        #4
        Originally posted by jbu311
        thanks, that was exactly what i needed
        This can be done even with table. Give a id to your table's td ( Means use id attribute of JavaScript and use it as parameter below)
        Code:
        document.getElementById('td_id').innerHTML = "This is the text for the image";

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          You can also just show a hidden div, e.g. [html]<div id="someDiv" style="visibili ty:hidden">This is the text for the image</div>[/html] with this JavaScript code: [code=javascript]document.getEle mentById("someD iv").style.visi bility = "visible";[/code]

          Comment

          Working...