FileUpload acceptプロパティ

Fileupload 对象参考手册Fileupload オブジェクト

定義と用法

accept プロパティは、カンマ区切りの\nコンテンツタイプを設定または返します。

構文

accept プロパティを設定する:

fileuploadObject.accept="content-type,content-type,..."

accept プロパティを返す:

fileuploadObject.accept


ブラウザサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザは accept プロパティをサポートしています!ただし、\nFirefox、Opera、\nおよび Chrome ブラウザのみがファイルタイプを返します。


例

例

<input type="file"> 要素が受け入れ可能なコンテンツタイプを表示します:

<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>

試してみる »


Fileupload 对象参考手册Fileupload オブジェクト その他の拡張