DOM Textarea 对象

Textarea Object

The Textarea object represents a text-area in an HTML form. For each instance of an HTML <textarea> tag in a form, a Textarea object is created.

You can access a Textarea object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().

IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).

Textarea Object Properties

PropertyDescriptionIE FNW3C
accessKeySets or returns the keyboard key to access the textarea4  Yes
colsSets or returns the width (in characters) of the textarea316Yes
defaultValueSets or returns the initial contents of the textarea3  Yes
disabledSets or returns whether or not the textarea should be disabled516Yes
formReturns a reference to the textarea's parent form312Yes
idSets or returns the id of the textarea (In IE 4 this property is read-only)41 No
nameSets or returns the name of the textarea312Yes
readOnlySets or returns whether or not the textarea should be read-only416Yes
rowsSets or returns the height (in rows) of the textarea316Yes
tabIndexSets or returns the tab order for the textarea4  Yes
typeReturns the type of the form element. For a textarea object it will always be "textarea"313Yes
valueSets or returns the text in the textarea312Yes

Textarea Object Methods

MethodDescriptionIEFNW3C
blur()Removes focus from the textarea312Yes
click()Simulates a mouse-click in the textarea4  No
focus()Sets focus on the textarea312Yes
select()Selects and highlights the entire text that is in the textarea412Yes

Textarea Object Events

Syntax: object.event_name="someJavaScriptCode"

EventDescriptionIEFNW3C
onBlurExecutes some code when the textarea loses focus312 
onChangeExecutes some code when the textarea loses focus and its value has altered312 
onClickExecutes some code when the user clicks the left mouse button in the textarea4   
onFocusExecutes some code when the textarea gets focus312 
onKeyDownExecutes some code when a key is pressed down in the textarea 14 
onKeyPressExecutes some code when a key is pressed in the textarea 14 
onKeyUpExecutes some code when a key is released in the textarea 14 
onSelectExecutes some code when some text in the textarea is selected 12 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值