最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Disable JavaScript keypress events in iframes - Stack Overflow

programmeradmin2浏览0评论

How do I disable the support for JavaScript keypress events in iframes?

I need keypress events disabled only in specific iframes, so doing a catch-all-events-and-make-em-do-nothing solution is not an option.

How do I disable the support for JavaScript keypress events in iframes?

I need keypress events disabled only in specific iframes, so doing a catch-all-events-and-make-em-do-nothing solution is not an option.

Share Improve this question asked Nov 30, 2008 at 14:07 cllpsecllpse 21.7k37 gold badges133 silver badges170 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Does this example does what you want ?

According to this thread, something along the line of:

document.getElementById('edit').contentWindow.addEventListener('keypress', cK, true);

helps capturing keypress in a given iframe. If they can be captured, they can be disabled.

Warning: as pointed out by Allain Lalonde in the ments:

This will work if the iframe's content isn't from another domain.

发布评论

评论列表(0)

  1. 暂无评论