Ticket #7329: replacebycode.html

File replacebycode.html, 3.4 KB (added by Rajasimhan, 13 years ago)

replacebycode.html

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