<html>
<body>
一个 FileUpload 对象:
<input type="file" id="myFile" name="filename">
<p>单击下面的按钮可显示和/或更改上面文件按钮的 name 属性的值。</p>
<button onclick="display()">显示名称</button>
<button onclick="change()">修改名称</button>
<script>
function display() {
var x = document.getElementById("myFile").name;
alert("文件按钮的名称是:" + x);
}
function change() {
var x = document.getElementById("myFile").name = "newFileName";
alert ("名称已更改为:" + x);
}
</script>
</body>
</html>