当前位置: 首页 > 网络学院 > 客户端脚本教程 > 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 |