HTML DOM FileUpload Object

previous <http://www.w3schools.com/htmldom/dom_obj_event.asp> next <http://www.w3schools.com/htmldom/dom_obj_form.asp>
------------------------------------------------------------------------



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




Michael McGrady wrote:

One of the problems you run into with this is that there are differing behaviors between IE and the other browsers.

Michael McGrady wrote:

Leandro Melo wrote:

I'm no expert here, but i think you're gonna have to
deal with the tradicional and ordinary file button as
it comes. In other words, i don't think it's possible
to use an image for this button.
That's not because of struts, it's how the browsers
implement thier html.


--- "Dean A. Hoover" <[EMAIL PROTECTED]>
escreveu:


I've been reading some interesting methods for
using image buttons on forms in place of the
familiar "Submit" style browser generated
buttons. There is one automatically generated
button that I am still puzzled on how to use
an image for it, though. That's the one for
do file uploading, as in:

<html:form method="POST"
enctype="multipart/form-data">
<html:file property="theFile"/>
<html:submit value="Upload"/>
</html:form>

Any ideas?
Dean Hoover





THIS CAN BE DONE. You have to shut off the automagically button and then use another image for a button via JavaScript. I am going to do this too, so let's cooperate on it.


Michael McGrady


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to