FileUpload type 屬性

定義和用法
type 屬性返回 FileUpload 對象的 form 元素類型。
對於 FileUpload 對象,該屬性返回 "file"。
語法
fileuploadObject.type
流覽器支持
所有主要流覽器都支持 type 屬性
實例
實例
顯示 FileUpload 對象的 form 元素的類型:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.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>IT研修(xuhuhu.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>
