Does the HTMLEditor control raise any client-side events?
- by SAMIR BHOGAYTA
The HTML Editor has three modes: Design, HTML Text and preview mode.
Design mode is in an IFrame. HTML Text is prensented in a TextArea and preview mode is in another Iframe. The code rendered about these three modes is as below.
iframe
id="editor1_ctl02_ctl00" name="editor1_ctl02_ctl00" marginheight="0" marginwidth="0" frameborder="0" src="javascript:false;" style="height:100%;width:100%;display:none;border-width:0px;"
/iframe
textarea
id="editor1_ctl02_ctl01" class="ajax__htmleditor_htmlpanel_default" style="height:100%;width:100%;display:none;"
/textarea
iframe
id="editor1_ctl02_ctl02" name="editor1_ctl02_ctl02" marginheight="0" marginwidth="0" frameborder="0" src="javascript:false;" style="height:100%;width:100%;display:none;border-width:0px;"
/iframe
In design mode, we can use the following JavaScript to append a callback function in onKeypress event.
script type="text/javascript"
var count = 0;
function pageLoad() {
$get('editor1_ctl02_ctl00').contentWindow.document.body.onkeypress = function() {
count++;
$get('cc').innerHTML = "you input " + count + "charactors";
};
}
/script
As a same way, you can append another keypress event on TextArea and preview IFrame.