但是最近做了一个微小型的编辑器,方法为将一个iframe的designmode设为on. IE: //IframeSendMsg为iframe框架 IframeSendMsg.document.onkeydown=new Function("return HotKeyPress(IframeSendMsg.event);"); FireFox: 将designMode=on之后为该iframe通过以下方法添加事件处理函数(不要通过在body里写onkeydown等,不起作用的): //IframeSendMsg为iframe框架
IframeSendMsg.contentWindow.document.addEventListener("keydown",HotKeyPress2,
true); |
|