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