button-labels.html (1083B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Forms</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 </head> 8 <body> 9 <p> 10 <h3>button_labels</h3> 11 </p> 12 13 <hr> 14 15 <div id="log"></div> 16 17 <form method="post" 18 enctype="application/x-www-form-urlencoded" 19 action="" 20 id="input_form"> 21 <p><label>Full name:<label>(name)<button id='button_id1'>button1</button><small>Format: First Last</small></label></label></p> 22 <p><label>Age: <button id='button_id2'>button2</button></label></p> 23 </form> 24 <script> 25 test(function() { 26 var button1 = document.getElementById("button_id1"); 27 var button2 = document.getElementById("button_id2"); 28 29 assert_true(button1.labels instanceof NodeList, "button1.labels is NodeList"); 30 assert_equals(button1.labels.length, 2, "button1.labels.length"); 31 32 assert_true(button2.labels instanceof NodeList, "button2.labels is NodeList"); 33 assert_equals(button2.labels.length, 1, "button2.labels.length"); 34 }); 35 </script> 36 37 </body> 38 </html>