读书人

让文本框获得焦点的方法是txt1.focus(

发布时间: 2012-03-13 11:21:10 作者: rapoo

让文本框获得焦点的方法是txt1.focus(),那失去焦点的方法是什么?
rt

[解决办法]
blur
[解决办法]
onblur 在对象失去输入焦点时触发。
[解决办法]
blur Method Internet Development Index

--------------------------------------------

Causes the element to lose focus and fires the onblur event.

Syntax

object.blur()
Return Value

No return value.

Remarks

This method shifts focus away from the element to which it is applied, but this does not set focus on the next element in the tab order.

As of Microsoft® Internet Explorer 5, elements that expose the blur method must have the TABINDEX attribute set.

Standards Information

This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .

[解决办法]
obj.blur();

读书人网 >JavaScript

热点推荐