FileUpload Object
For each instance of an HTML <input type="file"> tag on a form, a
FileUpload
object is created.
All FileUpload objects are stored in the elements array of the corresponding form.
You can access a FileUpload object by indexing this array - either by number (0
represents the first element in a form) or by using the value of the name
attribute.
The FileUpload object's properties, methods, and events are
described below:
N: Netscape (including Mozilla when N6 or higher), IE: Internet Explorer, W3C:
World Wide Web Consortium (Internet Standard)
Properties
Syntax: object.property_name
Property |
Description |
N |
IE |
W3C |
accept |
Sets or returns a list of content types that the server
that processes this form will handle correct |
|
- |
Yes |
accessKey |
Sets or returns the keyboard key to access the FileUpload object |
|
4 |
Yes |
align |
Sets or returns the alignment of the FileUpload object according to
the surrounding text |
|
- |
Yes |
alt |
Sets or returns an alternate text to display if the browser
does not support <input type="file"> |
|
- |
Yes |
defaultValue |
Sets or returns the initial value of the FileUpload object |
3 |
4 |
Yes |
disabled |
Sets or returns whether or not the FileUpload object should be
disabled |
|
4 |
Yes |
form |
Returns a reference to the form that contains the FileUpload object |
3 |
4 |
Yes |
id |
Sets or returns the id of the FileUpload object (In IE 4 this
property is read-only) |
|
4 |
No |
name |
Sets or returns the name of the FileUpload object |
3 |
4 |
Yes |
tabIndex |
Sets or returns the index that defines the tab order for
the FileUpload object |
|
4 |
Yes |
type |
Returns the type of the form element. For a FileUpload object
it will be "file" |
3 |
4 |
Yes |
value |
Returns the file name of the FileUpload object after the
text is set by user input |
3 |
4 |
Yes |
Methods
Syntax: object.method_name()
Method |
Description |
N |
IE |
W3C |
blur() |
Removes focus from the FileUpload object |
3 |
4 |
Yes |
click() |
Simulates a mouse-click on the FileUpload object |
|
4 |
No |
focus() |
Gives focus to the FileUpload object |
3 |
4 |
Yes |
select() |
Selects the FileUpload object |
|
4 |
Yes |
Events
Syntax: object.event_name="someJavaScriptCode"
Event |
Description |
NN |
IE |
W3C |
onBlur |
Executes some code when the FileUpload object loses focus |
3 |
4 |
|
onClick |
Executes some code when the FileUpload object gets a mouse
click |
3 |
4 |
|
onFocus |
Executes some code when the FileUpload object gets focus |
3 |
4 |
|
onSelectStart |
Executes some code when the FileUpload object gets selected |
|
4 |
|
|