Disable Button

Results 1 to 2 of 2

Thread: Disable Button

  1. #1
    Join Date
    Dec 1969

    Default Disable Button

    Hi All, i got a html page with a textbox and a button. What i want to do is if the textbox is null, i.e. no text putted in, the button will be disable, and once there r input, it will enable it. what is the code i need for doing this? thanks~

  2. #2
    Join Date
    Dec 1969

    Default RE: Disable Button

    JavaScript is the usual way:<BR><BR>Use a submit event handler in you &#060;form&#062; element eg<BR><BR>onsubmit="return checkMyForm()"<BR><BR>Then add a JavaScript function to receive the call:<BR><BR>&#060;script language="JavaScript"&#062;<BR>&#060;!--<BR>function checkMyForm() {<BR> if(document.forms[0].MyInputBoxName.value=="") {<BR> return false;<BR> } else {<BR> return true;<BR> }<BR>}<BR>//--&#062;<BR>&#060;/script&#062;

Posting Permissions

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