w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: DOM Input File ¶ÔÏó
For each instance of an <input type="file"> tag in an HTML form, a FileUpload object is created.
HTML±íµ¥ÖгöÏÖ<input type="file">±êÇ©¾ÍÒâζ×ÅFileUpload¶ÔÏó½¨Á¢ÆðÀ´ÁË
You can access a FileUpload object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
Äã¿ÉÒÔͨ¹ýÔªËØÊý×éË÷Òý»òÊÇÓÃgetElementById()À´·ÃÎÊFileUpload¶ÔÏó
IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).
| Property ÊôÐÔ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| accept | Sets or returns a list of content types, which the server processing this form will handle correctly ÉèÖûò·µ»ØÄÚÈÝÀàÐÍÁÐ±í£¬·þÎñÆ÷¿É¸ü׼ȷµÄ´¦Àí±íµ¥ |
- | Yes | ||
| accessKey | Sets or returns the keyboard key to access the FileUpload object ÉèÖûò·µ»Ø¿É·ÃÎÊFileUpload¶ÔÏóµÄ°´¼ü |
4 | Yes | ||
| align | Sets or returns the alignment of the FileUpload object according to the surrounding text ÉèÖûò·µ»ØFileUpload¶ÔÏóÏà¶ÔÓÚÖÜΧÎÄ×ÖµÄ¶ÔÆë·½Ê½ |
- | Yes | ||
| alt | Sets or returns an alternate text to display if the browser does not support <input type="file"> ÉèÖûò·µ»ØÌæ»»ÏÔʾµÄÎÄ×Ö£¬Õë¶ÔÄÇЩÎÞ·¨Ö§³Ö<input type="file">µÄä¯ÀÀÆ÷ |
- | Yes | ||
| defaultValue | Sets or returns the initial value of the FileUpload object ÉèÖûò·µ»ØFileUpload¶ÔÏóµÄ³õʼֵ |
4 | 1 | 3 | Yes |
| disabled | Sets or returns whether or not the FileUpload object should be disabled ÉèÖûò·µ»ØFileUpload¶ÔÏóÊÇ·ñ¿ÉÓà |
4 | Yes | ||
| form | Returns a reference to the form that contains the FileUpload object ·µ»Ø°üº¬FileUpload¶ÔÏóµÄ±íµ¥²Î¿¼ |
4 | 1 | 3 | Yes |
| id | Sets or returns the id of the FileUpload object (In IE 4 this property is read-only) ÉèÖûò·µ»ØFIleUpload¶ÔÏóµÄid |
4 | 1 | No | |
| name | Sets or returns the name of the FileUpload object ÉèÖûò·µ»ØFileUpload¶ÔÏóµÄname |
4 | 1 | 3 | Yes |
| tabIndex | Sets or returns the index that defines the tab order for the FileUpload object ÉèÖûò·µ»ØFileUpload¶ÔÏóµÄtab˳Ðò |
4 | Yes | ||
| type | Returns the type of the form element. For a FileUpload object it will be "file" ·µ»Ø±íµ¥ÔªËØÀàÐÍ£¬FileUpload¶ÔÏó¾Í·µ»Ø"file" |
4 | 1 | 3 | Yes |
| value | Returns the file name of the FileUpload object after the text is set by user input ·µ»ØFileUpload¶ÔÏóÔÚÓû§ÊäÈëºóµÄÎļþÃû³Æ |
4 | 1 | 3 | Yes |
| Method ·½·¨ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| blur() | Removes focus from the FileUpload object È¡Ïû¶ÔFileUpload¶ÔÏóµÄ¾Û½¹ |
4 | 1 | 3 | Yes |
| click() | Simulates a mouse-click on the FileUpload object Ä£·ÂÊó±êµã»÷FileUpload¶ÔÏó |
4 | No | ||
| focus() | Gives focus to the FileUpload object ÈÃFileUpload¶ÔÏó»ñµÃ¾Û½¹ |
4 | 1 | 3 | Yes |
| select() | Selects the FileUpload object Ñ¡ÔñFileUpload¶ÔÏó |
4 | Yes |
Syntax: object.event_name="someJavaScriptCode"
Óï·¨£º¶ÔÏó.ʼþÃû³Æ="һЩJS´úÂë"
| Event ʼþ |
Description ÃèÊö |
IE | F | N | W3C |
|---|---|---|---|---|---|
| onBlur | Executes some code when the FileUpload object loses focus µ±FileUpload¶ÔÏóʧȥ¾Û½¹µÄʱºòÖ´ÐдúÂë |
4 | 1 | 3 | |
| onClick | Executes some code when the FileUpload object gets a mouse click µ±FileUpload¶ÔÏó±»Êó±êµã»÷µÄʱºòÖ´ÐдúÂë |
4 | 1 | 3 | |
| onFocus | Executes some code when the FileUpload object gets focus µ±FileUpload¶ÔÏó»ñµÃ¾Û½¹µÄʱºòÖ´ÐдúÂë |
4 | 1 | 3 | |
| onSelectStart | Executes some code when the FileUpload object gets selected µ±FileUpload¶ÔÏó±»Ñ¡ÖеÄʱºòÖ´ÐдúÂë |
4 |
ÆÀÂÛ (0)
All