FileUpload formプロパティ

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

定義と使い方

form プロパティは、FileUpload オブジェクトを含むフォームへの参照を返します。

このプロパティは form オブジェクトを返します。

構文

fileuploadObject.form


ブラウザサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザは form プロパティをサポートしています。


例

例

次の例は、<input type="file"> 要素が属するフォームの id を返します:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<script>
function displayResult(){
    var x=document.getElementById("fname").form.id;
    alert(x);
}
</script>
</head>
<body>

<form id="form1">
アップロードするファイルを選択してください:
<input type="file" id="fname" size="50"/>
</form>
<button type="button" onclick="displayResult()">fileupload を含むフォームを表示</button>

</body>
</html>

試してみる »


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