Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Mouseover = Image + text in cell

  1. #1
    Join Date
    Oct 2005
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Mouseover = Image + text in cell

    Okay, i've been doing java for a couple of years now, but just started javascript. What I need is to have a mouseover event put an image in one cell of a table and text in another cell. Any help would be greatly appreciated. Thanks!

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

    Default

    HTML Code:
    <table onmouseover="document.getElementById('addImage').innerHTML = '<img src=\'image.png\'/>'; document.getElementById('addText').innerHTML = '<p>Text goes here</p>';">
      <tr>
        <td id="addImage"></td>
        <td id="addText"></td>
      </tr>
    </table>
    One question: Eclipse or NetBeans?
    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!

  3. #3
    Join Date
    Oct 2005
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    why can i not get this working? I think i'm just an idiot... =(

    If i put it between the <script> it doesn't make the table but if i put it outside the <script> it doesn't do the mouse over... sorry i'm such a noob with this.
    Last edited by Eclyps19; 10-15-2005 at 01:19 PM.

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

    Default

    Hm, what's your error?
    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!

  5. #5
    Join Date
    Oct 2005
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    wow you're quick... no error just look at the previous post

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

    Default

    Don't put it in <script> tags, just add the above onmouseover event to whatever you want to mouseover, and set the IDs of the two cells for the content to appear in as above.
    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!

  7. #7
    Join Date
    Oct 2005
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    
    <p><img src="file:///C|/Documents%20and%20Settings/Renee/My%20Documents/Websites/slickandbubbas.jpg" width="89" height="48" onmouseover="document.getElementById('addImage').innerHTML = '<img src=\'image.png\'/>'; document.getElementById('addText').innerHTML = '
      <p>Text goes here</p>';"></p>
    
    <table width="472" height="128" border="1" >  
    <tr>  <td id="addImage"></td>  <td id="addText"></td>  </tr> </table>
    </body>
    </html>

    What i've got is just a picture at the top, i want the mouseover on that, and then the 2 cells at the bottom to display something.

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

    Default

    Take the newline away from before the paragraph.
    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!

  9. #9
    Join Date
    Oct 2005
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    wow... something so simple... thanks a lot =)

  10. #10
    Join Date
    Oct 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default browser compatibility

    Does this script work with firefox and all other browsers. I'm havin a hard time getting it to work. I'm slightly rookie noob. go to:

    http://www.citynightslimousine.com/casanuestra.html

    http://www.citynightslimousine.com/dutchhenry.html

    Hopefuly by looking at those 2 pages you'll understand what i'm trying to accomplish by using script like this instead of having seperate html files for each winery info and the refresh blink of the seperate html files can be annoying too. I'm using dreamweaver, and a noobie at it. I'm a lil over my head as I'm sure you'll notice what I've been producing as a hobby.

    anyone help....

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
  •