HTML DOM는 FileUpload 속성을 수락
정의 및 사용
속성 세트를 승인 또는 쉼표로 구분 된 콘텐츠 형식을 반환합니다.
문법
속성을 수락 설정 :
fileuploadObject.accept="content-type,content-type,..."
반환 속성을 수락 :
fileuploadObject.accept
브라우저 지원
모든 주요 브라우저 속성을 받아 지원됩니다! 하지만 파이어 폭스, 오페라, 크롬 브라우저는 파일 형식을 반환합니다.
예
예
디스플레이 <입력 유형 = "파일"> 요소 사용 가능한 콘텐츠 유형 :
<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("fname").accept;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
选择一个文件上传:
<input type="file" id="fname" size="50" accept="video/*">
</form>
<button type="button" onclick="displayResult()">显示接收文件的类型</button>
</body>
</html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("fname").accept;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
选择一个文件上传:
<input type="file" id="fname" size="50" accept="video/*">
</form>
<button type="button" onclick="displayResult()">显示接收文件的类型</button>
</body>
</html>
»시도
파일 업로드 객체