The disabled Property


The disabled Property

The disabled property lets you knowor enables you to setwhether an element is disabled. If a button is disabled, for example, its caption is grayed out, and you can't click it. You can find the support for this property in Table 5.19.

Table 5.19. The disabled Property

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

disabled

     

x

   

x

x

x

x

 

Read/Write

 

Type: Boolean

Here's an example where I'm disabling a button:

(Listing 05-11.html on the web site)
 <HTML>      <HEAD>          <TITLE>Using the disabled Property</TITLE>      </HEAD>      <BODY>          <H1>Using the disabled Property</H1>          <FORM>              <INPUT ID="button1" TYPE="BUTTON" ONCLICK="alert('Hello!')" VALUE="Click graphics/ccc.gif Me!">          </FORM>          <SCRIPT LANGUAGE="JavaScript">              <!--  document.all.button1.disabled = true  // -->          </SCRIPT>      </BODY>  </HTML> 

You can see the results in Figure 5.8.

Figure 5.8. Using the disabled property.

graphics/05fig08.gif

Tip

As we'll see in Chapter 21, you also can use the disabled property to disable and enable CSS style sheets.




Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net