Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: RE: how do you enable/disable a form button


Message #1 by "Lei Zhou" <leizhou@s...> on Fri, 16 Aug 2002 23:32:17
In IE you can use the disabled attribute, but for most browsers you are 
better off using onfocus="blur();" although if Javascript is disabled this 
will not work, why not display them as plain text ?

At 23:32 16/08/02 +0000, you wrote:
>Hi,
>
>Could you please send me some info regarding how to enable/disable form
>elements for Netscape?
>
>Thanks
>
>Lei
>
>
> > I'm not sure how to check if the user has visited the page before (I you
> > want to use cookies, parameter in the QueryString or something similar).
> >
> > But to enable/disable a button, you can write code like this (IE only,
> > version 4 and up):
> >
> >
> > changeButtonState(true) to disable it, changeButtonState(false) to enable
> > it.
> >
> >
> > <script language="JavaScript" type="text/javascript">
> >       function changeButtonState(bDisable){
> >               document.all.forwardInput.disabled = bDisable;
> >       }
> > </script>
> >
> > <body>
> >
> >       <form>
> >               <input type="button" id="forwardInput">
> >       </form>
> >
> > </body>
> >
> >
> >
> >
> > /Robert
> >
> >
> >
> > -----Original Message-----
> > From: nick [mailto:nick@i...]
> > Sent: den 1 oktober 2001 13:17
> > To: javascript
> > Subject: [javascript] RE: how do you enable/disable a form button
> >
> >
> > How would i go about enabling /disabling a forward navigation button
>then?
>
>---
>
>Improve your web design skills with these new books from Glasshaus.
>
>Usable Web Menus
>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>r-20
>Constructing Accessible Web Sites
>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>r-20
>Practical JavaScript for the Usable Web
>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>r-20



  Return to Index