SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2000
    Location
    Madawaska, ME, USA
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would like to make a button appear or disappear using the onClick event handler. Is this possible?

  2. #2
    SitePoint Zealot jonsteele's Avatar
    Join Date
    Jan 2001
    Location
    Toronto
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    This is what you need to do:

    1. Put the button in an absolute div

    Code:
    <div id="mydiv" style="position:absolute;left:100;top:100">
    <input type="button">
    </div>
    2. Make a functions like:

    Code:
    function show(){
    if(document.layers) document.layers['mydiv'].visibility="show";
    if(document.getElementById) document.getElementById("mydiv").style.visibility="visible";
    if(document.all) document.all.mydiv.style.visibility="visible";
    }
    
    function hide(){
    if(document.layers) document.layers['mydiv'].visibility="hide";
    if(document.getElementById) document.getElementById("mydiv").style.visibility="hidden";
    if(document.all) document.all.mydiv.style.visibility="hidden";
    }
    3. call the functions on your onclicks:

    Code:
    ... onclick="show()"...
    ... onclick="hide()"...
    Good luck!!

    Jon.


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
  •