Accessing Iframe DOM |
We don't suggest you access the DOM in editor iframe directly. Here is a sample code if you want to do it.
<script type='text/javascript'> var globaleditor=null; function editor_document_onmouseover(e) { if(!e)e=globaleditor.GetWindow().event; var domnode=e.target||e.srcElement; var rtenode=globaleditor.GetNodeFromDom(domnode); if(rtenode)rtenode.SetRuntimeAttribute("style","text-decoration:underline","mybehavior"); } function editor_document_onmouseout(e) { if(!e)e=globaleditor.GetWindow().event; var domnode=e.target||e.srcElement; var rtenode=globaleditor.GetNodeFromDom(domnode); if(rtenode)rtenode.SetRuntimeAttribute("style",null,"mybehavior"); } function AttachEditorEvent(editor) { var win=editor.GetWindow(); var doc=win.document; if(doc.addEventListener) { doc.addEventListener("mouseover",editor_document_onmouseover,false); doc.addEventListener("mouseout",editor_document_onmouseout,false); } else { doc.attachEvent("onmouseover",editor_document_onmouseover); doc.attachEvent("onmouseout",editor_document_onmouseout); } } function DetachEditorEvent(editor) { var win=editor.GetWindow(); var doc=win.document; if(doc.removeEventListener) { doc.removeEventListener("mouseover",editor_document_onmouseover,false); doc.removeEventListener("mouseout",editor_document_onmouseout,false); } else { doc.detachEvent("onmouseover",editor_document_onmouseover); doc.detachEvent("onmouseout",editor_document_onmouseout); } } function RichTextEditor_OnLoad(editor) { globaleditor=editor; AttachEditorEvent(editor); editor.AttachEvent("InitEvent",function(argeditor,argevent) { AttachEditorEvent(editor); }); editor.AttachEvent("UninitEvent",function(argeditor,argevent) { DetachEditorEvent(editor); }); } </script>
Send feedback about this topic to CuteSoft. © 2003 - 2012 CuteSoft Components Inc. All rights reserved.