Results 1 to 5 of 5

Thread: RESOLVED - (d)html & javascript: using "this" and elements...

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Location
    London
    Posts
    10

    RESOLVED - (d)html & javascript: using "this" and elements...

    I have this javascript code:

    Code:
    <script type="text/javascript">
    function disp()
    {
    	n = document.getElementById('btwo');	
    	n.style.display=n.style.display=='block'?'none':'block';
    }
    </script>
    And this html:
    Code:
    <tr id="two">
    	<td><a href="javascript:void(0)" class="clink" onclick="disp()">Topic: Two</a>
    		<blockquote id="btwo" class="DisplayNone">Some bumf about this topic</blockquote>
    	</td>
    </tr>
    The bit in the blockquote is initially hidden, then when you click the link ("Topic: Two"), it shows the hidden bit (..toggles display style).

    I need to un-hardcode the 'btwo' in the script part...

    I tried using onclick="disp(this)" , but my knowledge of the DOM tree is pitiful...

    Any help / hints appreciated.
    Thanks
    Last edited by deeperdish; Apr 22nd, 2004 at 09:42 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width