The disabled PropertyThe 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
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 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.
Tip As we'll see in Chapter 21, you also can use the disabled property to disable and enable CSS style sheets. |