Events
Events
|
Description
|
||
onBlur
|
Code is
executed when the focus is removed from the fileUpload field.
|
||
onChange
|
Code is
executed when user changes the value within the fileUpload field and moves
focus away from field.
|
||
onFocus
|
Code is
executed when the focus is set on the fileUpload field.
|
||
Properties
Properties
|
Description
|
form
|
References the form that contains the reset
button.
|
accessKey
|
String value that sets/ returns the accessKey for
the button.
|
name
|
Reflects the name of the text field (the name
attribute).
|
id
|
Reflects the id of the text field (the id attribute).
|
value
|
Read string that specifies the value of the file
input.
HTML
<input type="file" id="f1"
/>
<input type="button" value="Status"
onclick="MyFunction()" />
JavaScript
function
MyFunction() {
var file = document.getElementById("f1").value;
alert(file);
//we cannot
set the value of fileupload due to security reasons.
}
|
type
|
A
property available on all form elements, "type" returns the type of
the calling form element, in this case, "file".
|
accept
|
The accept attribute is
incredibly useful. It is a hint to browsers to only show files that are
allowed for the current input .
While it can typically be overridden by users, it helps narrow down the
results for users by default, so they can get exactly what they're looking
for without having to sift through a hundred different file types.Note: These examples were written based on the current specification and may not actually work in all (or any) browsers. The specification may also change in the future, which could break these examples.
<!-- Match
all image files (image/*) -->
<input type="file"
accept="image/*">
<!-- Match
all video files (video/*) -->
<input type="file"
accept="video/*">
<!-- Match
all audio files (audio/*) -->
<input type="file"
accept="audio/*">
<!-- Match
all image files (image/*) and files with the extension ".someext"
-->
<input type="file"
accept=".someext,image/*">
<!-- See
note below -->
<!-- Match
all image files (image/*) and video files (video/*) -->
<input type="file"
accept="image/*,video/*">
|
dir
|
Ltr or rtl. The dir attribute specifies the text
direction of the element's content.
|
disabled
|
Boolean value that sets/ returns whether the
button is disabled.
|
tabindex
|
The tabindex attribute specifies the tab order of an element (when
the "tab" button is used for navigating).
|
class
|
The
class attribute specifies one or more classnames for an element.
|
style
|
The
style attribute specifies an inline style for an element.
|
title
|
The title attribute specifies extra information
about an element.
The
information is most often shown as a tool tip text when the mouse moves over
the element.
|
Methods
Methods
|
Description
|
||
blur()
|
Removes
focus away from the fileUpload field.
|
||
focus()
|
Sets
focus on the fileUpload field.
|
||
select()
|
Selects
the input area of the fileUpload field.
|
||
No comments:
Post a Comment