Hi snips,
The example below shows you how to get the same count as the right bottom in editor. hope it help.
<!-- #include file = "cuteeditor_files/include_CuteEditor.asp" -->
<html>
<head>
</head>
<body>
<form name="theForm" action="Edithtml.asp?postback=true" method="post">
<%
Dim editor
Set editor = New CuteEditor
editor.ID = "Editor1"
editor.MaxTextLength=25
If request.QueryString("postback") <> "true" then
editor.Draw()
else
editor.SaveFile("document.html")
editor.Draw()
End if
' Request.Form(ID) access from other page
%>
<input type="button" value="GetPlainText" onclick="GetPlainText()" />
<div id="plainText" style="visibility: hidden">
</form>
</body>
</html>
<script>
function isIE() {
if (window.navigator.userAgent.toLowerCase().indexOf("msie") != -1) return true;
else return false;
}
function GetPlainText() {
var editor1 = document.getElementById('<%=editor.ClientID%>');
var plainText = document.getElementById("plainText");
plainText.innerHTML = editor1.GetHTML();
var text;
if (isIE()) {
text = plainText.innerText;
}
else {
text = plainText.textContent;
}
var words = text.replace(/\s+/g, "-").split("-");
var count = 0;
for (var i = 0; i < words.length; i++) {
if (words[i] != "") {
count++;
}
}
alert(count);
plainText.innerHTML = "";
}
</script>
Regards,
Ken