当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > DOM Textarea 对象

HTML DOM
DOM 介绍
HTML DOM 举例
DOM 参考
DOM 摘要
HTML DOM 实例
DOM Anchor
DOM Applet
DOM Area
DOM Base 对象
DOM Basefont对象
DOM Body 对象
DOM Document 对象
DOM 事件
DOM Form 对象
DOM Frame 对象
DOM Frameset 对象
DOM History
DOM Iframe 对象
DOM Image 对象
HTML DOM Button对象

HTML DOM 中的 DOM Textarea 对象


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 779 ::
收藏到网摘: n/a

Textarea 对象

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.
Textarea对象代表了HTML表单中的文字区域。每当表单中出现<textarea>标签就意味着建立了Textarea对象

You can access a Textarea object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
你可以使用索引元素数组的索引数或是名称来访问Textarea对象,也可以使用getElementById()来访问

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

Textarea 对象属性

Property
属性
Description
描述
IE  F N W3C
accessKey Sets or returns the keyboard key to access the textarea
设置或返回访问textarea的快捷键
4     Yes
cols Sets or returns the width (in characters) of the textarea
设置或返回textarea的宽度(用每行可容纳的文字数来做依据)
3 1 6 Yes
defaultValue Sets or returns the initial contents of the textarea
设置或返回textarea初始内容
3     Yes
disabled Sets or returns whether or not the textarea should be disabled
设置或返回textarea的状态
5 1 6 Yes
form Returns a reference to the textarea's parent form
返回textarea的父表参考
3 1 2 Yes
id Sets or returns the id of the textarea (In IE 4 this property is read-only)
设置或返回textarea的id值
4 1   No
name Sets or returns the name of the textarea
设置或返回textarea的name
3 1 2 Yes
readOnly Sets or returns whether or not the textarea should be read-only
设置或返回textarea是否应该为只读
4 1 6 Yes
rows Sets or returns the height (in rows) of the textarea
设置或返回textarea的高度(可由rows属性值来做调整)
3 1 6 Yes
tabIndex Sets or returns the tab order for the textarea
设置或返回textarea的tab顺序
4     Yes
type Returns the type of the form element. For a textarea object it will always be "textarea"
返回表单元素类型。textarea对象返回为"textarea"
3 1 3 Yes
value Sets or returns the text in the textarea
设置或返回textarea的文字
3 1 2 Yes

Textarea 对象方法

Method
方法
Description
描述
IE F N W3C
blur() Removes focus from the textarea
取消textarea的焦点
3 1 2 Yes
click() Simulates a mouse-click in the textarea
模仿鼠标在textarea里的点击
4     No
focus() Sets focus on the textarea
为textarea设置焦点
3 1 2 Yes
select() Selects and highlights the entire text that is in the textarea
选中并用高亮textarea里面的文字
4 1 2 Yes

Textarea 对象事件

语法: object.event_name="someJavaScriptCode"

Event
事件
Description
描述
IE F N W3C
onBlur Executes some code when the textarea loses focus
当textarea失去焦点的时候执行代码
3 1 2  
onChange Executes some code when the textarea loses focus and its value has altered
当textarea失去焦点的时候里面的内容又发生变化则执行一些代码
3 1 2  
onClick Executes some code when the user clicks the left mouse button in the textarea
当鼠标左键在textarea里点击后执行某些代码
4      
onFocus Executes some code when the textarea gets focus
当textarea得到焦点的时候执行代码
3 1 2  
onKeyDown Executes some code when a key is pressed down in the textarea
当在textarea里按住键的时候执行某些代码
  1 4  
onKeyPress Executes some code when a key is pressed in the textarea
当textarea里按过键就执行某些代码
  1 4  
onKeyUp Executes some code when a key is released in the textarea
当在textarea里释放按键的时候执行代码
  1 4  
onSelect Executes some code when some text in the textarea is selected
当textarea里的某些文字被选中的时候执行某些代码
  1 2  

评论 (0) All

登陆 | 还没注册?