html 标签中的 unselectable = on 属性的作用

在IE浏览器中,当input获得焦点时,点击有unselectable="on"属性的标签时,不会触发onblur事件。

1.body内代码:

<div>
    <p><input id="txt" type="text"/></p>
    <p><span unselectable="on">unselectable="on"</span></p>
    <p><span unselectable="">span测试2 unselectable=""</span></p>

    <p><div unselectable="on">div测试1 unselectable="on"</div></p>
    <p><div unselectable="">div测试2 unselectable=""</div></p>
</div>

2.js代码

<script type="text/javascript">
    (function () {
        var txt = document.getElementByIdx_x_x("txt");
        txt.onblur = function () { alert('失去焦点了'); }
    })();
</script>

 

IE浏览器显示效果图

 

posted @ 2016-11-14 11:40  三高娘子  阅读(1137)  评论(0)    收藏  举报