dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: innner html thing mentioned in "goodies to go"

  1. #1
    Join Date
    Dec 2002
    Location
    England
    Posts
    2

    innner html thing mentioned in "goodies to go"

    *** This question was submitted to our Mentor Community. The answer
    was provided by Taylor Smith.

    Q. I would like to know if it is possible to make an image open in a
    particular table of a cell from a link in another cell. Kind of like
    with
    frames where you tell it to open in a TARGET frame.

    A. If you give a cell a <span> with a name you can access it with
    cellname.innerHTML="New Stuff".
    For example
    <table>
    <tr>
    <td><a onclick="magiczone.innerHTML='Look here now!'">Click to change
    something.</a></td> <td><span name="magiczone">Pretty boring over
    here.</span></td> </tr> </table>
    When someone clicks the link the text changes. You can use <span> like
    that
    anywhere in your files.
    All I get is a script error when I run it. On looking up InnerHTML on google, I get a whole bunch of conflicting stuff, involving everything from c# to shtml :P

    What's the deal there, has anyone else had issuse, does it need some other code piece that was missing?

    It sounds like a really useful bit of code if it worked

    cheers

    John

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    <td><a onclick="magiczone.innerHTML='Look here now!'">Click to change something.</a></td> <td><span name="magiczone">Pretty boring over here.</span></td>
    More W3C DOM compliant:

    <td><a href="#" onclick="document.getElementById('magiczone').innerHTML='Look here now!';return false">Click to change something.</a></td> <td><span id="magiczone">Pretty boring over here.</span></td>

    Don't expect it to work in NS 4.X or below.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles