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

HTML DOM
DOM Input Checkbox
DOM Input File 对象
DOM Input Hidden对象
DOM Input Password 对象
DOM Input Radio 对象
DOM Input Reset 对象
DOM Input Submit 对象
DOM Input Text 对象
DOM Link 对象
DOM Location 对象
DOM Meta 对象
DOM Navigator 对象
DOM 对象
DOM Option 对象
DOM Screen 对象
DOM Select 对象
DOM Style 对象
DOM Table 对象
DOM TableData 对象
DOM TableHeader 对象

HTML DOM 中的 DOM Input Text 对象


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

Text 对象

The Text object represents a text field in an HTML form. For each instance of an <input type="text"> tag in an HTML form, a Text object is created.
Text 对象代表了HTML表单中的text field,每当HTML表单中出现<input type="text">标签就意味着Text 对象被建立起来了

You can access a Text object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
你可以从表单数组的数字或是名称来访问Text 对象,或是使用getELmentById()来访问它

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

Text 对象属性

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 text field
设置或返回能够访问 text field 的键盘按键。
4 - - Yes
align Sets or returns the alignment of the text field according to the surrounding text
设置或返回 text field 相对周围文字的对齐方式
-     Yes
alt Sets or returns an alternate text to display if the browser does not support text fields
设置或返回对于那些无法支持 text field 浏览器的替换文字。
-     Yes
defaultValue Sets or returns the initial value of the text field
设置或返回 text field的初始值
3 1 2 Yes
disabled Sets or returns whether or not the text field should be disabled
设置或返回 text field是否应该禁用。
5 1 6 Yes
form Returns a reference to the text field's parent form
返回包含 text field 表单的参考
3 1 2 Yes
id Sets or returns the id of the text field (In IE 4 this property is read-only)
设置或返回 text field的id(在IE4中这个属性只读)
4 1   No
maxLength Sets or returns the maximum number of characters in the text field
设置或返回 text field中最大限度字符数
4 1 6 Yes
name Sets or returns the name of the text field
设置或返回 text field的name
3 1 2 Yes
readOnly Sets or returns whether or not the text field should be read-only
设置或返回 text field是否为只读
4 1 6 Yes
size Sets or returns the size of the text field
设置或返回 text field 的大小
3 1 6 Yes
tabIndex Sets or returns the tab order for the text field
设置或返回 text field由tab顺序所定义的索引
4     Yes
type Returns the type of the form element. For a text object it will always be "text"
返回表单元素类型,是 text field的话就会返回为" text field"
3 1 3 Yes
value Sets or returns the value of the value attribute of the text field
设置或返回 text field value属性的值
3 1 2 Yes

Text 对象方法

Method
方法
Description
描述
IE F N W3C
blur() Removes focus from the text field
取消 text field的聚焦
4 1 2 Yes
click() Simulates a mouse-click in the text field
模仿鼠标点击 text field
4     No
focus() Sets focus on the text field
让 text field 获得聚焦
3 1 2 Yes
select() Selects the content of the text field
选中 text field 的内容
4 1 2 Yes

Text 对象事件

Syntax: object.event_name="someJavaScriptCode"
语法:对象.事件名称=“一些JS代码”

Event
事件
Description
描述
IE F N W3C
onBlur Executes some code when the text field loses focus
当 text field失去聚焦的时候执行一些代码
4 1 2  
onChange Executes some code when the text field loses focus and its value has altered
当 text field失去聚焦并且它的值发生变动的时候执行一些代码
3 1 2  
onClick Executes some code when the user clicks the left mouse button in the text field
当用户在 text field中用鼠标左键点击时执行一些代码
4      
onFocus Executes some code when the text field gets focus
当 text field获得聚焦的时候执行一些代码
3 1 2  
onKeyDown Executes some code when a key is pressed in the text field
在 text field中有键按住的时候执行一些代码
4 1 4  
onKeyPress Executes some code when an alphanumeric key is pressed in the text field
当 text field 中有键按下并释放后执行一些代码
4 1 4  
onKeyUp Executes some code when a key is released in the text field
当 text field 中按键释放则执行一些代码
4 1 4  
onSelect Executes some code when the current selection is changed in the text field
当 text field里当前选中的内容发生变化时执行一些代码
3 1 2  
onSelectStart Executes some code when some text in the text field is selected
当 text field中一些文字被选中则执行一些代码
4      

评论 (0) All

登陆 | 还没注册?