javascript for limit charecter in ajax Html Editor

Jun 6 2011 3:54 AM
Hello,
I am using a Html editor Control  and i want to limit the carectors of this control.
I am able to do this for ity's Html mode but the same script is not running for design mode. the code I am using is the following :

function




alert(content);

wc = content.split(

wr = tw - wc;


alert(

}


idt.innerHTML = wr +

}

countWords() {var a = $find("<%=TxtResponseOne.ClientID%>");var content = a.get_content();var tw = 200;' ').length;if (wr <= 0) {"You can enter only " + tw + "Words Maximum !");var idt = document.getElementById('<%=ROneCount.ClientID %>');" Words Remaining.";


Sys.Application.add_load(


function() {//alert("gfdh");


var editor = $find("<%= TxtResponseOne.ClientID %>"); // Editor's ID="editor"



alert(designMode);



designPanel.captureInDesign =


countWords();

}


}

});

var editPanel = editor.get_editPanel();var designMode = AjaxControlToolkit.HTMLEditor.ActiveModeType.Design;var designPanel = editPanel.get_modePanels()[designMode];var content = editor.get_content();function(ev) {if (ev.type == "keypress" || ev.type == "keydown") {return true;




and the editor sorce is:


<table width="100%" border="0" cellpadding="0" cellspacing="0" runat="server" id="Table1">


<tr>


<td align="left" valign="top" width="60%" class="grey_ver11">


<cc2:editor width="600px" height="150px" runat="server" id="TxtResponseOne"></cc2:editor>

<%


--<custom:CustomEditor id="TxtResponseOne" width="600px" height="150px" runat="server" />--%></td>


<td align="right" class="grey_ver11" valign="top" width="40%">


<div id="ROneCount" class="DefaultTextBoxCounterStyle" runat="server">


</div>


</td>


</tr>


</table>


Thanks.

Answers (6)