TUTORIAL前端与浏览器FETCHED
FileUpload type 属性
FileUpload type 属性 Fileupload 对象 定义和用法 type 属性返回 FileUpload 对象的 form 元素类型。 对于 FileUpload 对象,该属性返回 “file”。 语法 fileuploadObject.type 浏览器支持 所有主要浏览器都支持 type 属性 实例 实例 显示 FileUpload 对象的 form 元素的类型: [mycode2] ..
更新于 2026/7/16
教程详情页默认 noindex。
FileUpload type 属性
Fileupload 对象
定义和用法
type 属性返回 FileUpload 对象的 form 元素类型。
对于 FileUpload 对象,该属性返回 "file"。
语法
fileuploadObject.type
浏览器支持
![]()
![]()
![]()
![]()
![]()
所有主要浏览器都支持 type 属性
实例
实例
显示 FileUpload 对象的 form 元素的类型:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function displayResult(){
var x=document.getElementById("fname").type;
alert(x);
}
</script>
</head>
<body>
<form>
选择一个文件上传:
<input type="file" id="fname">
</form>
<button type="button" onclick="displayResult()">显示 input 类型</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function displayResult(){
var x=document.getElementById("fname").type;
alert(x);
}
</script>
</head>
<body>
<form>
选择一个文件上传:
<input type="file" id="fname">
</form>
<button type="button" onclick="displayResult()">显示 input 类型</button>
</body>
</html>
尝试一下 »
Fileupload 对象