Results 1 to 2 of 2

Thread: Onclick Div that doesn't hide

  1. #1
    Join Date
    Apr 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Onclick Div that doesn't hide

    I am looking for a script for a contact list.

    I want it to load in the same area, but be separate DIVs and be activated by click.



    For example. Click the envelope beside David Alpner's name, it loads a form to contact him. Click the envelope beside Mimi Polk Gitlin's name, it loads a contact form in the same DIV, and so on.

    I could just use email addys on click, but to avoid spam, I want to try it this way. I don't want to use Iframes either, as there will be thousands of addresses added.

    I've been searching and working for the past two hours and can't get it to work. Can anyone point me in the right direction?

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    If I understand you correctly, this should work:

    Javascript (goes in the head):
    Code:
    <script type="text/javascript">
    <!--
        function toggle_visibility(id) {
           var e = document.getElementById(id);
           if(e.style.display == 'block')
              e.style.display = 'none';
           else
              e.style.display = 'block';
        }
    //-->
    </script>
    CSS:
    Code:
    .contact { display:none; }
    HTML:
    Code:
    <a href="#" onclick="toggle_visibility('david');"><img src="envelope.gif"></a>David Alper
    
    
    <div class="contact" id="david">
        <form>
         ...
        </form>
    </div>

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
  •