Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: js hookup warnings when the content has been changed
Re: js hookup warnings when the content has been changed
03-21-2010, 9:05 PM
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: js hookup warnings when the content has been changed
Reply
Quote
Hi wolf11th,
Try the example below
<%@ Page Language=
"C#"
%>
<%@ Register TagPrefix=
"CE"
Namespace=
"CuteEditor"
Assembly=
"CuteEditor"
%>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head id=
"Head1"
runat=
"server"
>
<title>example</title>
</head>
<body>
<form id=
"Form1"
runat=
"server"
>
<CE:Editor ID=
"editor1"
runat=
"server"
>
</CE:Editor>
<input type=
"button"
value=
"check"
onclick=
"check()"
/><br />
click on the button,
if
you changed the text, it will show a message.
<asp:Label ID=
"label1"
runat=
"server"
Style=
"visibility: hidden"
></asp:Label>
</form>
</body>
</html>
<script type=
"text/javascript"
>
var editor1=document.getElementById(
"<%= editor1.ClientID %>"
);
var label1=document.getElementById(
"<%= label1.ClientID %>"
);
function CuteEditor_OnInitialized(editor)
{
editor.SetHTML(
"this is a test"
);
label1.innerHTML=editor1.getHTML();
}
function check()
{
var str1=label1.innerHTML.toLowerCase();
var str2=editor1.getHTML().toLowerCase();
if
(!(str1.indexOf(str2)==0 && str2.indexOf(str1)==0))
{
alert(
"text have been changed"
);
}
}
</script>
Regards,
Ken
View Complete Thread