Thursday, December 8, 2011

Tip: - Disable Submit button using Javascript


A simple function for disabling the Submit button inorder to avoid multiple clicks by user.

function disableSubmit(whichButton)
{
            if (document.getElementById)
           {
               // this is the way the standards work
               document.getElementById(whichButton).disabled = true;
           }
           else if (document.all)
          {
               // this is the way old msie versions work
              document.all[whichButton].disabled = true;
          }
          else if (document.layers)
         {
              // this is the way nn4 works
             document.layers[whichButton].disabled = true;
         }
}

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments : on " Tip: - Disable Submit button using Javascript "