admin管理员组文章数量:1022405
I have an Iframe which I have enabled designMode on. Quite simply I would like to have a callback function called if the cursor in the Iframe moves or content changes. It seemed quite simple at first but I can't use onchange/ onkeyup on the Iframe.
I assume I need to add an event to a member of the Iframe. I've tried
frames['writer'].document.body.onkeyup = eventHandler
to no success.
Update
I've found that setting designMode = 'on'
is causing the problems. If I ment out the line that sets designMode to 'on'
then handling events works fine.
I have an Iframe which I have enabled designMode on. Quite simply I would like to have a callback function called if the cursor in the Iframe moves or content changes. It seemed quite simple at first but I can't use onchange/ onkeyup on the Iframe.
I assume I need to add an event to a member of the Iframe. I've tried
frames['writer'].document.body.onkeyup = eventHandler
to no success.
Update
I've found that setting designMode = 'on'
is causing the problems. If I ment out the line that sets designMode to 'on'
then handling events works fine.
2 Answers
Reset to default 6OK, I have a solution:
if(document.addEventListener)
{
frames['writer'].document.addEventListener('keyup', updateStatus, false);
frames['writer'].document.addEventListener('mouseup', updateStatus, false);
}
It works a charm!
Try writing a function called document.onkeyup:
function document.onkeyup() {
// do stuff
}
I've never seen that style before, but that was just something I found on Google...
I have an Iframe which I have enabled designMode on. Quite simply I would like to have a callback function called if the cursor in the Iframe moves or content changes. It seemed quite simple at first but I can't use onchange/ onkeyup on the Iframe.
I assume I need to add an event to a member of the Iframe. I've tried
frames['writer'].document.body.onkeyup = eventHandler
to no success.
Update
I've found that setting designMode = 'on'
is causing the problems. If I ment out the line that sets designMode to 'on'
then handling events works fine.
I have an Iframe which I have enabled designMode on. Quite simply I would like to have a callback function called if the cursor in the Iframe moves or content changes. It seemed quite simple at first but I can't use onchange/ onkeyup on the Iframe.
I assume I need to add an event to a member of the Iframe. I've tried
frames['writer'].document.body.onkeyup = eventHandler
to no success.
Update
I've found that setting designMode = 'on'
is causing the problems. If I ment out the line that sets designMode to 'on'
then handling events works fine.
2 Answers
Reset to default 6OK, I have a solution:
if(document.addEventListener)
{
frames['writer'].document.addEventListener('keyup', updateStatus, false);
frames['writer'].document.addEventListener('mouseup', updateStatus, false);
}
It works a charm!
Try writing a function called document.onkeyup:
function document.onkeyup() {
// do stuff
}
I've never seen that style before, but that was just something I found on Google...
本文标签: javascriptFinding when an Iframe39s content changes when in designModeStack Overflow
版权声明:本文标题:javascript - Finding when an Iframe's content changes when in designMode - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745573377a2156872.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论