FileUpload type 屬性

定義和用法
type 屬性返回 FileUpload 對象的 form 元素類型。
對于 FileUpload 對象,該屬性返回 "file"。
語法
fileuploadObject.type
瀏覽器支持
所有主要瀏覽器都支持 type 屬性
實例
實例
顯示 FileUpload 對象的 form 元素的類型:
<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("fname").type;
alert(x);
}
</script>
</head>
<body>
<form>
Select a file to upload:
<input type="file" id="fname">
</form>
<button type="button" onclick="displayResult()">Display input type</button>
</body>
</html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("fname").type;
alert(x);
}
</script>
</head>
<body>
<form>
Select a file to upload:
<input type="file" id="fname">
</form>
<button type="button" onclick="displayResult()">Display input type</button>
</body>
</html>
嘗試一下 ?

更多建議: