首页javascriptfile_uploadJavascript Form - 如何从文件上传输入框中获取NAME属性

Javascript Form - 如何从文件上传输入框中获取NAME属性

我们想知道如何从文件上传输入框中获取NAME属性。


<html>
    <body>
        <script language="JavaScript">
        function getname(){
             var boxname = document.form1.myUploadbox.name;
             console.log("The name of the FileUpload box is: " + boxname);
        }
        </script>
        <form name="form1">
        Click on the button below to get the name of the upload box.
        <br><br>
        <input type="file" name="myUploadbox">
        <br><br>
        <input type="button" value="Get Name" onClick='getname()'>
    </form>
</html>