setTimeout函数
<body>
<input id=”t” type=”text” value=”selected?” />
<script type=”text/javascript”>
document.getElementById(‘t’).onfocus = function(){
this.select();
return false;
}
</script>
</body>
以上代码在maxthon的-webkit-浏览模式下,不能通过.
方案:使用setTimeout函数把selete事件放到最后.
v.onfocus = function(){
var that = this;
window.setTimeout(function(){
that.select();
},0);
};
<body> <input id=”t” type=”text” value=”selected?” /> <script type=”text/javascript”> document.getElementById(‘t’).onfocus = function(){ this.select(); return false; } </script></body>以上代码在maxthon的-webkit-浏览模式下,不能通过.方案:使用setTimeout函数把selete事件放到最后.v.onfocus = function(){ var that = this; window.setTimeout(function(){ that.select(); },0);};