在Internet Explorer 6中更改后模糊选择 [英] Blur a select after change in Internet Explorer 6

查看:106
本文介绍了在Internet Explorer 6中更改后模糊选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的问题真的。除IE6以外的所有软件都适用:

 < html> 
< body>
< / body>
< select id =testonchange =blur()>
< option name =one> One< / option>
< option name =two>两个< / option>
< option name =three>三< / option>
< / select>
< / html>

有没有办法在IE6中使用它?允许JavaScript和JQuery黑客入侵。

任何想法,评论或提示?
在此先感谢

解决方案

在jQuery中:

 < script type =text / javascript> 
$(function(){
$('#test')。change(function(){
$(this).blur();
});
});
< / script>

或者您可以尝试替换:



与:

 < select id =testonchange = JavaScript的:模糊(本); > 

UPDATE :实际上,IE6 JavaScript引擎似乎存在模糊问题()



一个(非理想的)解决方法是:

 < script type =text / javascript> 
$(function(){
$('#test')。change(function(){
$('body')。focus();
});
});
< / script>

通过集中处理HTML文档,这将使选择输入字段失去焦点。


Simple question really. This works in all but IE6:

<html>
<body>
</body>
<select id="test" onchange="blur()">
<option name="one">One</option>
<option name="two">Two</option>
<option name="three">Three</option>
</select>
</html>

Is there anyway to get this working in IE6? JavaScript and JQuery hacks allowed.

Any ideas, remarks or tips? Thanks in advance

解决方案

Under jQuery:

<script type="text/javascript">
$(function() {
    $('#test').change(function() {
        $(this).blur();
    });
});
</script>

Or you may try replacing:

With:

<select id="test" onchange="javascript:blur(this);">

UPDATE: Actually it seems that the IE6 JavaScript engine has problems with blur()

A (non-ideal) work around is:

<script type="text/javascript">
$(function() {
    $('#test').change(function() {
        $('body').focus();
    });
});
</script>

Which will lose focus on the select input field by focussing the HTML document.

这篇关于在Internet Explorer 6中更改后模糊选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆