fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <script> function getElements(){ var x=document.getElementsByName("x"); alert(x.length); } </script> </head> <body> 猫: <input name="x" type="radio" value="猫"> 狗: <input name="x" type="radio" value="狗"> <input type="button" onclick="getElements()" value="多少名称为 'x'的元素?"> </body> </html>
运行结果