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 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2005
    Location
    Canberra, ACT
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with Span

    Hi guys, could one of you look at this code if you get a chance - it's not working for me:

    *Essentially what I am trying to do is have a description of a thumbnail appear in a "span" when a user clicks on a thumbnail (as well as a full version of the photo appear in another part of the table, which currently works okay). For some reason or another, it's just not happening.

    <html>
    <head>

    <link rel="stylesheet" href="style.css"/>

    </head>

    <body>

    <h1>Photo Page</h1>

    <h2>My Favorite Holiday</h2>

    <table width="100%" border="0">
    <tr>
    <td><img src="images/thumbs/holiday1thumb.jpg" width="100" height="75" onClick="document.getElementById('picture').src='images/full/holiday1.jpg'; document.getElementById('info').innerText='My wife Katrina and I dining'"></td>
    <td rowspan="4"><img id=picture src="images/fill.gif"></td>
    </tr>
    <tr>
    <td><img src="images/thumbs/holiday2thumb.jpg" width="75" height="100" onClick="document.getElementById('picture').src='images/full/holiday2.jpg';"></td>
    </tr>
    <tr>
    <td><img src="images/thumbs/holiday3thumb.jpg" width="100" height="75" onClick="document.getElementById('picture').src='images/full/holiday3.jpg';"></td>
    </tr>
    <tr>
    <td><img src="images/thumbs/holiday4thumb.jpg" width="100" height="75" onClick="document.getElementById('picture').src='images/full/holiday4.jpg';"></td>
    </tr>
    </table>

    <br /><br />

    <p><span id=info></span></p>

    </body>

    </html>

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    innerText?

    I think you wanted innerHTML.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New Coder
    Join Date
    Aug 2005
    Location
    Canberra, ACT
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I changed it, and it worked - thank you very much.

    Is InnerHTML W3C compliant?

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    NO.
    But it's pretty well supported.
    If you want it to specs, you have to use createElement, appendChild, and the like. More work. Might be more cross-browser, but all the major ones right now support innerHTML.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

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