Redky

web前端开发/HTML/CSS/JavaScript

setTimeout函数

without comments

<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);};

Written by jim

八月 12th, 2010 at 8:13 下午

Posted in 体会生活

Tagged with

Leave a Reply