document.getElementById('xxx_input').focus();
执行成功滴前提是document.getElementById('xxx_input')可以找到!lz怎么保证document.getElementById('xxx_input')一定可以找到?!
或者说在50毫秒后一定就能找到?!不妨改为500再试试看!50和500对于用户感受而言没差别,
对于cpu可是差了一个数量级!
执行成功滴前提是document.getElementById('xxx_input')可以找到!lz怎么保证document.getElementById('xxx_input')一定可以找到?!
或者说在50毫秒后一定就能找到?!不妨改为500再试试看!50和500对于用户感受而言没差别,
对于cpu可是差了一个数量级!
-----------------
在设置focus()时对象存在且没有disabled=true;就像yixianggao说的 保证document.getElementById('xxx_input')一定可以找到
if(document.getElementById('text_xxx')) {
if (IS_IE){
document.getElementById('text_xxx').value = " ";
document.getElementById('text_xxx').focus();
document.getElementById('text_xxx').value = "";
document.getElementById('text_xxx').select();
}else{
document.getElementById('text_xxx').focus();
}
}