Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
onblur event for cute editor
onblur event for cute editor
Last post 03-26-2012, 8:00 AM by
Kenneth
. 3 replies.
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
03-23-2012, 8:50 AM
73545
Rameshdurai
Joined on 01-06-2012
Posts 5
onblur event for cute editor
Reply
Quote
Hi All,
How can i add blur event for cute editor control?, if u have nay samples please update
Many Thanks
Ramesh durai
03-23-2012, 10:38 AM
73547
in reply to
73545
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: onblur event for cute editor
Reply
Quote
Hi Rameshdurai,
Please try the example below, it shows you how to catch the focus/blur function of editor.
<%@ Page Language=
"C#"
%>
<%@ 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>example</title>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<input type=
"text"
id=
"text1"
/>
<p>Please note that textbox text changes when the focus change </p>
<CE:Editor ID=
"editor1"
runat=
"server"
>
</CE:Editor>
</form>
</body>
</html>
<script>
var text1=document.getElementById(
"text1"
);
function CuteEditor_OnInitialized(editor)
{
var editdoc = editor.GetDocument();
//for ie
if
(document.attachEvent)
{
editdoc.onfocusin=function()
{
text1.value=
"focus in"
;
}
editdoc.onfocusout=function()
{
text1.value=
"focus out"
;
}
}
//for firefox, chrome
else
{
editdoc.body.addEventListener(
"focus"
,focusIn,
false
);
editdoc.body.addEventListener(
"blur"
,focusOut,
false
);
}
}
function focusIn()
{
text1.value=
"firefox in"
;
}
function focusOut()
{
text1.value=
"firefox out"
;
}
</script>
Regards,
Ken
03-24-2012, 12:51 AM
73553
in reply to
73547
Rameshdurai
Joined on 01-06-2012
Posts 5
Re: onblur event for cute editor
Reply
Quote
Hi Ken,
Thanks for your reply,
alone above provided code works very fine.
but, in my page i have 4 cute editors, then, how can set CuteEditor_OnInitialized() event separately for each
cute editors?
Many Thanks
Ramesh durai
03-26-2012, 8:00 AM
73559
in reply to
73553
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: onblur event for cute editor
Reply
Quote
Hi
Rameshdurai,
Method CuteEditor_OnInitialized will set it for each editor. You can separate it by editor.id.
Like the example below
<%@ Page Language=
"C#"
%>
<%@ 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>example</title>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<input type=
"text"
id=
"text1"
/>
<p>Please note that textbox text changes when the focus change </p>
<CE:Editor ID=
"editor1"
runat=
"server"
>
</CE:Editor>
<CE:Editor ID=
"editor2"
runat=
"server"
>
</CE:Editor>
</form>
</body>
</html>
<script>
var text1=document.getElementById(
"text1"
);
function CuteEditor_OnInitialized(editor)
{
var editdoc = editor.GetDocument();
//for ie
if
(document.attachEvent)
{
editdoc.onfocusin=function()
{
text1.value=
"focus in"
;
}
editdoc.onfocusout=function()
{
text1.value=
"focus out"
;
}
}
//for firefox, chrome
else
{
editdoc.body.addEventListener(
"focus"
,focusIn,
false
);
editdoc.body.addEventListener(
"blur"
,focusOut,
false
);
}
}
function focusIn()
{
text1.value=
"firefox in"
;
}
function focusOut()
{
text1.value=
"firefox out"
;
}
</script>
Regards,
Ken