如何使DIV没有焦点? [英] how to make a DIV unfocusable?

查看:180
本文介绍了如何使DIV没有焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b 在IE7的dir =rtl文档中,当JavaScript尝试将焦点设置为DIV元素(使用oElement。焦点()方法),渲染变成混乱。上下文是非常复杂的,所以我想最简单的解决方法是使DIV不可聚焦?



有没有办法让DIV不被关注?

< div> 除非已添加,否则无法获得焦点如果您添加了 tabIndex ,您应该将其移除。 tabIndex p>

  document.getElementById(yourElement)。removeAttribute(tabIndex); 


I met a problem about HTML rendering.

In dir="rtl" document of IE7, when JavaScript tries to set focus to a DIV element(with oElement.focus() method), the rendering turns to mess. The context is very complicated, so I suppose the easiest fix is to make the DIV unfocusable?

Is there any way to make a DIV not be focused?

解决方案

The <div> should not be capable of receiving focus unless you have added tabIndex.

If you have added tabIndex, you should remove it by

document.getElementById("yourElement").removeAttribute("tabIndex");

这篇关于如何使DIV没有焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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