Ticket #8706: 8706.html

File 8706.html, 3.4 KB (added by Garry Yao, 12 years ago)
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<!--
3Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.html or http://ckeditor.com/license
5-->
6<html xmlns="http://www.w3.org/1999/xhtml">
7<head>
8        <title>Replace Textarea by Code &mdash; CKEditor Sample</title>
9        <meta content="text/html; charset=utf-8" http-equiv="content-type" />
10        <!-- CKReleaser %REMOVE_LINE%
11        <script type="text/javascript" src="../ckeditor.js"></script>
12        CKReleaser %REMOVE_START% -->
13        <script type="text/javascript" src="../ckeditor_source.js"></script>
14        <!-- CKReleaser %REMOVE_END% -->
15        <script src="sample.js" type="text/javascript"></script>
16        <link href="sample.css" rel="stylesheet" type="text/css" />
17</head>
18<body>
19        <h1 class="samples">
20                CKEditor Sample &mdash; Replace Textarea Elements Using JavaScript Code
21        </h1>
22        <div class="description">
23        <p>
24                This sample shows how to automatically replace all <code>&lt;textarea&gt;</code> elements
25                with a CKEditor instance by using a JavaScript call.
26        </p>
27        <p>
28                To replace a <code>&lt;textarea&gt;</code> element, place the following call at any point
29                after the <code>&lt;textarea&gt;</code> element or inside a <code>&lt;script&gt;</code> element located
30                in the <code>&lt;head&gt;</code> section of the page, in a <code>window.onload</code> event handler:
31        </p>
32        <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>' );</pre>
33        <p>
34                Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
35                the <code>&lt;textarea&gt;</code> element to be replaced.
36        </p>
37        </div>
38
39        <!-- This <div> holds alert messages to be display in the sample page. -->
40        <div id="alerts">
41                <noscript>
42                        <p>
43                                <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
44                                support, like yours, you should still see the contents (HTML data) and you should
45                                be able to edit it normally, without a rich editor interface.
46                        </p>
47                </noscript>
48        </div>
49        <form action="sample_posteddata.php" method="post">
50                <p>
51                        <label for="editor1">
52                                Editor 1:</label>
53                        <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
54                        <script type="text/javascript">
55                        //<![CDATA[
56
57                                // This call can be placed at any point after the
58                                // <textarea>, or inside a <head><script> in a
59                                // window.onload event handler.
60
61                                // Replace the <textarea id="editor"> with an CKEditor
62                                // instance, using default configurations.
63                                var editor = CKEDITOR.replace( 'editor1',
64                                {
65                                        on :
66                                        {
67                                                'instanceReady' : function()
68                                                {
69                                                        editor.on( 'dialogShow', function( ev ) { } );
70                                                        editor.openDialog( 'colordialog' );
71                                                }
72                                        }
73                                } );
74
75                        //]]>
76                        </script>
77                </p>
78                <p>
79                        <input type="submit" value="Submit" />
80                </p>
81        </form>
82        <div id="footer">
83                <hr />
84                <p>
85                        CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
86                </p>
87                <p id="copy">
88                        Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
89                        Knabben. All rights reserved.
90                </p>
91        </div>
92</body>
93</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy