FileUpload form 屬性

定義和用法
form 屬性返回包含 FileUpload 對象的表單引用。
property 返回 form 對象。
語法
fileuploadObject.form
瀏覽器支持
所有主要瀏覽器都支持 form 屬性
實例
實例
下面的例子返回包含 <input type="file">元素所屬的表單的 id:
<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("fname").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
Select a file to upload:
<input type="file" id="fname" size="50">
</form>
<button type="button" onclick="displayResult()">Display id of container form</button>
</body>
</html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("fname").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
Select a file to upload:
<input type="file" id="fname" size="50">
</form>
<button type="button" onclick="displayResult()">Display id of container form</button>
</body>
</html>
嘗試一下 ?

更多建議: