3 <title>required/optional CSS pseudoclasses part
3</title>
5 input:required { background: lime; }
6 textarea:required { background: lime; }
7 input { background: red; }
8 textarea { background: red; }
10 <script language=
"JavaScript" type=
"text/javascript">
11 function log(message
) {
12 document
.getElementById("console").innerHTML
+= "<li>"+message
+"</li>";
16 if (window
.testRunner
)
17 testRunner
.dumpAsText();
19 v
= document
.getElementsByName("victim");
21 for (i
= 0; i
< v
.length
; i
++)
22 if (document
.defaultView
.getComputedStyle(v
[i
], null).getPropertyValue('background-color') == "rgb(0, 255, 0)")
29 <body onload=
"test()">
30 <p>All controls should have a green background.
</p>
31 <input name=
"victim" required
/>
32 <textarea name=
"victim" required disabled
/></textarea>
33 <textarea name=
"victim" required readonly
/></textarea>
35 <ol id=
"console"></ol>