Ticket #8302: mytestpage.html

File mytestpage.html, 3.3 KB (added by Jakub Ś, 14 years ago)

to use it just copy it into samples folder

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