50 users online (1 members and 49 guests)  


  Results 1 to 4 of 4

Related

  1. wrap text in a cell of a html table    Forum: HTML Forum
    Replies: 14
  2. Wrapping text around a cell in a table    Forum: HTML Forum
    Replies: 0
  3. Help with table incorporation with text    Forum: HTML Forum
    Replies: 6
  4. Can't Add Text Under My Table    Forum: HTML Forum
    Replies: 5
  5. Align text to Centered table    Forum: HTML Forum
    Replies: 6
  1. #1
    J-Man's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    32

    OnClick with Text in Table

    How do I capture "OnClick" events on the text within a cell? What I'm trying to do is click on text from the cells on the left, and put that "clicked on" text in a cell on the right? Any help would be greatly appreciated!!!!

  2. #2
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there J-Man,

    Welcome to these foums
    You may find that this is something similar to what you require...
    Code:
    <html>
    <head>
    
    <style type="text/css">
    <!--
    a {color: #000000; text-decoration: none;}
    div{width:100px; font-family:arial; font-size:14px; color:#000000;}
    table{width:200px;height:100px;border:solid 1px #000000; position:absolute; top:200px; left:300px;}
    td{width:100px;height:100px;border:solid 1px #000000;font-family:arial; font-size:14px; color:#000000; text-align:center; padding:0;}
    span{width:100px; visibility:visible;}
    //-->
    </style>
    
    <script type="text/javascript">
    <!-- 
    function clearcell()
    {
    document.getElementById("information").innerHTML ='<div> *</div>';
    }
    function description()
    {
    document.getElementById("information").innerHTML ='<div >Text<br /></div>';
    }
    //-->
    </script>
    
    </head>
    <body onload="clearcell();">
    
    <table ><tr>
    <td ><a href="javascript:description()"><span onclick="this.style.visibility='hidden'">Text</span></a></td>
    <td><div id="information"></div></td>
    </tr></table>
    
    </body>
    </html>
    I have tested this in I.E.6 and Netscape 7.1

    cthead

  3. #3
    J-Man's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    32
    Quote Originally Posted by coothead
    Hi there J-Man,

    Welcome to these foums
    You may find that this is something similar to what you require...
    Code:
    <html>
    <head>
    
    <style type="text/css">
    <!--
    a {color: #000000; text-decoration: none;}
    div{width:100px; font-family:arial; font-size:14px; color:#000000;}
    table{width:200px;height:100px;border:solid 1px #000000; position:absolute; top:200px; left:300px;}
    td{width:100px;height:100px;border:solid 1px #000000;font-family:arial; font-size:14px; color:#000000; text-align:center; padding:0;}
    span{width:100px; visibility:visible;}
    //-->
    </style>
    
    <script type="text/javascript">
    <!-- 
    function clearcell()
    {
    document.getElementById("information").innerHTML ='<div> *</div>';
    }
    function description()
    {
    document.getElementById("information").innerHTML ='<div >Text<br /></div>';
    }
    //-->
    </script>
    
    </head>
    <body onload="clearcell();">
    
    <table ><tr>
    <td ><a href="javascript:description()"><span onclick="this.style.visibility='hidden'">Text</span></a></td>
    <td><div id="information"></div></td>
    </tr></table>
    
    </body>
    </html>
    I have tested this in I.E.6 and Netscape 7.1

    cthead
    I got that to work...but I removed the information regarding "span". What is the purpose of the "span" stuff? Also, is it possible to embed your code in a form?

    Thanks so much for your help!!!!

  4. #4
    J-Man's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Nov 2003
    Posts
    32
    Quote Originally Posted by J-Man
    I got that to work...but I removed the information regarding "span". What is the purpose of the "span" stuff? Also, is it possible to embed your code in a form?

    Thanks so much for your help!!!!
    Just to let you know what I want to do...I want to capture the "div" information (see Coothead example) in a form.

    Thanks again!!



Tags for this Thread