html js input file,HTML DOM

HTML DOM Input FileUpload Object

Input FileUpload Object

The Input FileUpload object represents an HTML element with

type="file".

Access an Input FileUpload Object

You can access an element with type="file" by using getElementById():

var x = document.getElementById("myFile");

Try it

Tip: You can also access by searching through the elements collection of a form.

Create an Input FileUpload Object

You can create an element with type="file" by using the document.createElement() method:

var x = document.createElement("INPUT");

x.setAttribute("type", "file");

Try it

Input FileUpload Object Properties

= Property added in HTML5.

Property

Description

Sets or returns the value of the accept attribute of the file upload button

Sets or returns whether a file upload button should automatically get focus upon page load

defaultValue

Sets or returns the default value of the file upload button

Sets or returns whether the file upload button is disabled, or not

Returns a FileList object that represents the file or files selected with the file upload button

Returns a reference to the form that contains the file upload button

Sets or returns whether a user is allowed to select more than one file

in the file upload field

Sets or returns the value of the name attribute of the file upload button

Sets or returns whether a file in the file upload field must be selected

before submitting a form

Returns which type of form element the file upload button is

Returns the path or the name of the selected file

Standard Properties and Events

The Input FileUpload object also supports the standard properties and events.

Related Pages

HTML tutorial: HTML Forms

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值