首页javascriptformJavascript Form - 如何检查表单目标属性...

Javascript Form - 如何检查表单目标属性...

我们想知道如何检查表单目标属性。...

   
<html>
    <body>
    <script language="JavaScript">
    function showNumElements(){
         console.log("There are " + document.form1.length + " elements in this document");
    }
    </script>
    <form name="form1">
        Enter First Name:
        <input type="text" size=15><br>
        Enter Last Name:
        <input type="text" size=20><br>
        Enter address:
        <input type="text" size=40><br><br>
        <input type="button" value="Submit" onClick=showNumElements()>
    </form>
    </body>
</html>