Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: Rendering a rich Text control in Javascript
Re: Rendering a rich Text control in Javascript
10-29-2009, 6:36 AM
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Rendering a rich Text control in Javascript
Reply
Quote
Hi jgreenjr,
Try the example below
<%@ Page Language=
"C#"
AutoEventWireup=
"True"
%>
<%@ Register Namespace=
"CuteEditor"
Assembly=
"CuteEditor"
TagPrefix=
"CE"
%>
<!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>D</title>
</head>
<body>
<form id=
"Form1"
runat=
"server"
>
<div id=
"div1"
onclick=
"editContent()"
style=
"border: solid 1px red"
>
click me to start editing
</div>
<div id=
"div2"
style=
"visibility: hidden; position: absolute"
>
<CE:Editor ID=
"editor1"
runat=
"server"
>
</CE:Editor>
<input type=
"button"
value=
"Save"
onclick=
"save()"
/>
</div>
</form>
</body>
</html>
<script type=
"text/javascript"
>
var div1=document.getElementById(
"div1"
);
var div2=document.getElementById(
"div2"
);
var editor1=document.getElementById(
'<%= editor1.ClientID %>'
);
var content=div1.innerHTML;
function editContent()
{
div2.style.visibility=
"visible"
;
div1.style.visibility=
"hidden"
;
editor1.SetHTML(content);
editor1.FocusDocument();
}
function save()
{
div2.style.visibility=
"hidden"
;
div1.style.visibility=
"visible"
;
div1.innerHTML=editor1.GetHTML();
}
</script>
Regards,
ken
View Complete Thread