首页javascripttextareaJavascript Form - 如何从TextArea获取类型属性

Javascript Form - 如何从TextArea获取类型属性

我们想知道如何从TextArea获取类型属性。

<html>
<head>
    <script language="JavaScript1.1">
    function getType(){
      console.log("The name of this text area is " + document.myForm.elements[0].type);
    }
    </script>
    </head>
<body>
    <form name="myForm">
       <textarea name="myTextArea" rows=6 cols=50>
       Here is some text in my text area.
       </textarea>
       <input type=BUTTON value="Get Type" name="myButton" onClick='getType()'>
    </form>
</body>
</html>