日期:2014-05-16  浏览次数:20339 次

Extjs 中一个文本域怎么获取光标?
1、浏览器加载页面的时候,光标直接会在指定的文本域(如:textfield)。

2、页面加载完毕了,开始做验证,当某一项验证不通过时,光标回到此文本域中。

  谢谢啊! 请高手指点!

------解决方案--------------------
试试这个方法
HTML code

 
 focus( Boolean selectText, Boolean/Number delay ) : Ext.Component 
试着将焦点放到此项。Try to focus this component. 
试着将焦点放到此项。Try to focus this component. 
参数项: 
selectText : Boolean 
(可选的)true的话同时亦选中组件中的文本(尽可能)。(optional)If applicable, true to also select the text in this component 
delay : Boolean/Number 
(可选的)延时聚焦行为的毫秒数(true表示为10毫秒)。(optional) Delay the focus this number of milliseconds (true for 10 milliseconds) 
返回值: 
Ext.Component 
this