1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="Test_CKEditor.test" %> |
---|
2 | |
---|
3 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
4 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
5 | <head runat="server"> |
---|
6 | <title></title> |
---|
7 | <script src="ckeditor/ckeditor.js" type="text/javascript"></script> |
---|
8 | </head> |
---|
9 | <body> |
---|
10 | <form id="form1" runat="server"> |
---|
11 | |
---|
12 | <asp:ScriptManager ID="ScriptManager1" runat="server"> |
---|
13 | </asp:ScriptManager> |
---|
14 | |
---|
15 | <asp:UpdatePanel ID="UpdatePanel1" runat="server"> |
---|
16 | <ContentTemplate> |
---|
17 | <div> |
---|
18 | <textarea id="txt1" cols="20" name="txt1" rows="2"></textarea> |
---|
19 | <input id="button1" type="submit" onclick="destroyEditor();" /> |
---|
20 | </div> |
---|
21 | </ContentTemplate> |
---|
22 | </asp:UpdatePanel> |
---|
23 | <script type="text/javascript"> |
---|
24 | |
---|
25 | var timer; |
---|
26 | |
---|
27 | // CreateEditor is called from the code behind when the updatepanel loads |
---|
28 | function CreateEditor() { |
---|
29 | CKEDITOR.replace('txt1'); |
---|
30 | CKEDITOR.on('instanceReady', function () { clearTimeout(timer); timer = setTimeout("sendClick();", 1000); }) |
---|
31 | } |
---|
32 | |
---|
33 | function destroyEditor() { |
---|
34 | for (var i in CKEDITOR.instances) { |
---|
35 | CKEDITOR.instances[i].destroy(); |
---|
36 | } |
---|
37 | return true; |
---|
38 | } |
---|
39 | |
---|
40 | function sendClick() { |
---|
41 | document.getElementById('button1').click() |
---|
42 | } |
---|
43 | |
---|
44 | </script> |
---|
45 | </form> |
---|
46 | </body> |
---|
47 | </html> |
---|