Results 1 to 2 of 2

Thread: Make trigger dissapear on click..

  1. #1
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Make trigger dissapear on click..

    In the code below what do I need to add such that when the reveal() function is triggered, the trigger dissapears.

    Thanks

    Code:
    <script type="text/javascript">
    if(document.getElementById)
    document.write('<style type="text/css">.detail {float:left;display:none;}#zero {display:block;}<\/style>');
    function reveal(det){
    if(!document.getElementById) return;
    if (!document.getElementsByClassName){
    document.getElementsByClassName = function(cn){
    cn = cn.replace(/ +/g, ' ').split(' ');
    var ar = [], testname = function(n){
    for (var re, i = cn.length - 1; i > -1; --i){
    re = new RegExp('(^|\W)' + cn[i] + '(\W|$)');
    if(!re.test(n)) return false;
    }
    return true;
    }
    for(var d = document.all || document.getElementsByTagName('*'), i = 0; i < d.length; ++i)
    if(testname(d[i].className))
    ar[ar.length] = d[i];
    return ar;
    };
    document.getElementsByClassName.spoof = true;
    }
    for (var d = document.getElementsByClassName('detail'), i = d.length - 1; i > -1; --i)
    d[i].style.display = 'none';
    document.getElementById(det).style.display = 'block';
    if (document.getElementsByClassName.spoof)
    document.getElementsByClassName.spoof = document.getElementsByClassName = null;
    }
    </script>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It is unclear what's happening because we cannot see the associated markup. However, the code you have implies something like so:

    Code:
    <a href="#" onclick="reveal('some_id');return false;">Trigger</a>
    If that's about right, or if you can do it like that, then the easiest way to make the trigger disappear would be:

    Code:
    <a href="#" onclick="this.style.visibility = 'hidden';reveal('some_id');return false;">Trigger</a>
    or, depending upon whether or not you want it to just become invisible (above snippet) or to be removed from the layout as well:

    Code:
    <a href="#" onclick="this.style.display = 'none';reveal('some_id');return false;">Trigger</a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •