javascript hide button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kranthiviplav
    New Member
    • Mar 2008
    • 1

    javascript hide button

    hi,
    i want to enable/disable a button when an item in the listbox control is selected.can i get a function on this
  • kunal pawar
    Contributor
    • Oct 2007
    • 297

    #2
    Using javascript

    document.getEle mentById(Button Id).disabled = false;

    and if ur button is server control then
    button1.enabled = true

    Comment

    • malav123
      New Member
      • Feb 2008
      • 217

      #3
      HI,
      Use the function given below in java script it will works for u...
      function MoveItem(lstass ociatedstate, lstavailablesta te,f,v)
      {
      var hid;
      var id=v;
      hid = '';
      if(id=="ctl00_C ontentPlaceHold er1_TabAddCompa ny_TabPanel1_bt nnextone")
      {

      if ((lstavailables tate != null) && (lstassociateds tate != null))
      {
      if(lstavailable state.length < 1)
      {
      alert('There are no items in the source ListBox');
      return false;
      }
      if(lstavailable state.options.s electedIndex == -1) // when no Item is selected the index will be -1
      {
      alert('Please select an Item to move');
      return false;
      }

      while ( lstavailablesta te.options.sele ctedIndex >= 0 ) {
      var newOption = new Option(); // Create a new instance of ListItem
      newOption.text = lstavailablesta te.options[lstavailablesta te.options.sele ctedIndex].text;
      newOption.value = lstavailablesta te.options[lstavailablesta te.options.sele ctedIndex].value;

      lstassociatedst ate.options[lstassociatedst ate.length] = newOption; //Append the item in Target
      hid = hid + lstavailablesta te.options[lstavailablesta te.options.sele ctedIndex].value + ",";
      lstavailablesta te.remove(lstav ailablestate.op tions.selectedI ndex); //Remove the item from Source
      }
      }
      }
      }

      Comment

      Working...