visable/invisable button

Discussion in 'HTML' started by Bill Burke, Oct 1, 2005.

  1. Bill Burke

    Bill Burke Guest

    Hello,

    Is there a way to make an input button visable/invisable based on the value of a
    variable? Or any other method? How?

    TIA,
    Bill Burke
     
    Bill Burke, Oct 1, 2005
    #1
    1. Advertising

  2. Bill Burke

    Neredbojias Guest

    With neither quill nor qualm, Bill Burke quothed:

    > Hello,
    >
    > Is there a way to make an input button visable/invisable based on the value of a
    > variable? Or any other method? How?


    Javascript.

    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Oct 2, 2005
    #2
    1. Advertising

  3. Bill Burke wrote:
    > Is there a way to make an input button visable/invisable based on the
    > value of a variable? Or any other method? How?


    HTML doesn't have variables.
     
    Leif K-Brooks, Oct 2, 2005
    #3
  4. Bill Burke

    Spartanicus Guest

    Leif K-Brooks <> wrote:

    >> Is there a way to make an input button visable/invisable based on the
    >> value of a variable? Or any other method? How?

    >
    >HTML doesn't have variables.


    Client support is a variable ;-)

    --
    Spartanicus
     
    Spartanicus, Oct 2, 2005
    #4
  5. Bill Burke

    Toby Inkster Guest

    SONY_JP wrote:

    > <input id="invis" type=button value="Camouflage"
    > onmouseout="this.form.invis.style.display='none'">


    But useless if they use tab/spacebar to press the button.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Oct 2, 2005
    #5
  6. Bill Burke

    Dima Gofman Guest

    Here's a little demo. There are two easy methods of making buttons
    disappear: using block and visibility styles. If you use block like
    "SONY, JP" the browser will remove the button and redraw the page as if
    the button was never there - be careful with this method because it
    could break formatting of the rest of the page. Second method,
    visibility, will hide the button but leave the space where it was
    empty, keeping the formatting.


    <script type='text/javascript'>
    var flag=0;
    function toggleButton(){
    var obj=document.getElementById('cmd');
    if (flag==0){
    obj.style.visibility='hidden';
    flag=1;
    }
    else{
    flag=0;
    obj.style.visibility='visible';
    }
    }
    </script>

    <input type='button' id='toggle' value='Click to toggle'
    onclick='toggleButton()'>
    <input type='button' id='cmd' value='I am a button'>
     
    Dima Gofman, Oct 2, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    900
    Purvi T
    Oct 19, 2004
  2. Wes Weems
    Replies:
    1
    Views:
    497
    Natty Gur
    Jul 20, 2003
  3. Replies:
    1
    Views:
    486
    Knute Johnson
    Dec 15, 2006
  4. Yankee Imperialist Dog

    setting an html control to visable="true/false"

    Yankee Imperialist Dog, Jul 23, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    334
    clintonG
    Jul 24, 2008
  5. Kivak Wolf
    Replies:
    0
    Views:
    337
    Kivak Wolf
    Jun 19, 2009
Loading...

Share This Page