Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Enabling disable butons

    Hi guys 'n' gals,

    been really busy and not had chance to peek in. HAve question though.

    Have a button that needs to be enabled when server side scripting builds and populates a dynamic array, so will be written to teh client by the server. anyways.

    Bit of a dead end as the Enabled/Disable are not named attributes, they are arbritrary, so any ideas on how to enable them using client side script?

    ideas,code or pointers would be greatly apprecieted.

    ta

    kai

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    PHP Code:
    <form>
        <
    input type='button' id='MyButton' disabled>
    </
    form
    PHP Code:
    <script>
    function 
    Disable(){
        
    document.getElementByID('MyButton').disabled false;
    }
    </script> 
    Then just run the function however fits your needs.
    If I'm postin here, I NEED YOUR HELP!!

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    You can also enable the button in the server-side by not including the disabled property in the input tag. Have a variable that contains the string "disabled" or "" based on some conditions.

  • #4
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <script type="text/javascript">
    function 
    togglebutton(wichbutton){
      var 
    button document.getElementByID(wichbutton)
      if (
    button.disabled=true) {
        
    button.disabled false
      
    } else {
        
    button.disabled true
      
    }
    }
    </script> 
    With that you can disable or enable any button any time you wish...
    CATdude about IE6: "All your box-model are belong to us"


  •  

    Posting Permissions

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