javascript参考 表单元素的属性和方法 二
方法
blur
Removes focus from the text field.
方法源 Text
语法
blur()
参数
无
示例
The following example removes focus from the text element userText:
userText.blur() This example assumes that the text element is defined as
<INPUT TYPE="text" NAME="userText">
focus
Navigates to the text field and gives it focus.
方法源 Text
语法
focus()
参数
无
描述
Use the focus method to navigate to a text field and give it focus. You can then either programmatically enter a value in the field or let the user enter a value. If you use this method without the select method, the cursor is positioned at the beginning of the field.
handleEvent
调用指定事件的控制句柄。
方法源 Text
语法
handleEvent(event)
参数
event 你想要调用的对象的某一事件控制句柄的名称。
select
Selects the input area of the text field.
方法源 Text
语法
select()
参数
无
描述
Use the select method to highlight the input area of a text field. You can use the select method with the focus method to highlight a field and position the cursor for a user response. This makes it easy for the user to replace all the text in the field.
示例
The following example uses an onClick event handler to move the focus to a text field and select that field for changing:
<FORM NAME="myForm">
<B>Last name: </B><INPUT TYPE="text" NAME="lastName" SIZE=20 VALUE="Pigman">
<BR><B>First name: </B><INPUT TYPE="text" NAME="firstName" SIZE=20 VALUE="Victoria">
<BR><BR>
<INPUT TYPE="button" VALUE="Change last name"
onClick="this.form.lastName.select();this.form.lastName.focus();">
</FORM>
from:asp学习网/title:javascript参考 表单元素的属性和方法 二/ time:2007-3-30 20:26:53
本文主题表单元素