|
Revision 26, 0.6 kB
(checked in by simon, 3 years ago)
|
|
Added an HTML test to try different methods of setting the "for" attribute on a label element
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" |
|---|
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
|---|
| 3 | |
|---|
| 4 | <html> |
|---|
| 5 | |
|---|
| 6 | <head> |
|---|
| 7 | <title>Setting the "for" attribute on a label</title> |
|---|
| 8 | </head> |
|---|
| 9 | |
|---|
| 10 | <body> |
|---|
| 11 | <div> |
|---|
| 12 | <label for="in1">in markup</label> <input id="in1"><br> |
|---|
| 13 | <label id="l2">element["for"]</label> <input id="in2"><br> |
|---|
| 14 | <label id="l3">element.for</label> <input id="in3"><br> |
|---|
| 15 | <label id="l4">element.setAttribute</label> <input id="in4"> |
|---|
| 16 | </div> |
|---|
| 17 | <script type="text/javascript"> |
|---|
| 18 | document.getElementById("l2")["for"] = "in2"; |
|---|
| 19 | document.getElementById("l3").for = "in3"; |
|---|
| 20 | document.getElementById("l4").setAttribute("for", "in4"); |
|---|
| 21 | </script> |
|---|
| 22 | </body> |
|---|
| 23 | |
|---|
| 24 | </html> |
|---|