FileUpload formProperty

Fileupload 对象参考手册FileUpload Object

Definition and Usage

The form property returns a reference to the form containing the FileUpload object.

The property returns the form object.

Syntax

fileuploadObject.form


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the form property


Example

Example

The following example returns the id of the form that contains the <input type="file"> element:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
<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()">Show the form containing fileupload</button>

</body>
</html>

Try it Yourself »


Fileupload 对象参考手册FileUpload Object Other Extensions