1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> |
---|
2 | |
---|
3 | <!-- |
---|
4 | Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. |
---|
5 | For licensing, see LICENSE.html or http://ckeditor.com/license |
---|
6 | --> |
---|
7 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
8 | <head> |
---|
9 | <meta http-equiv="X-UA-Compatible" content="IE=8" /> |
---|
10 | <title>Replace Textarea by Code — CKEditor Sample</title> |
---|
11 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
---|
12 | <script type="text/javascript" src="../ckeditor.js"></script> |
---|
13 | <script src="sample.js" type="text/javascript"></script> |
---|
14 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
---|
15 | </head> |
---|
16 | <body> |
---|
17 | <h1 class="samples"> |
---|
18 | CKEditor Sample — Replace Textarea Elements Using JavaScript Code |
---|
19 | </h1> |
---|
20 | <div class="description"> |
---|
21 | <p> |
---|
22 | This sample shows how to automatically replace all <code><textarea></code> elements |
---|
23 | with a CKEditor instance by using a JavaScript call. |
---|
24 | </p> |
---|
25 | <p> |
---|
26 | To replace a <code><textarea></code> element, place the following call at any point |
---|
27 | after the <code><textarea></code> element or inside a <code><script></code> element located |
---|
28 | in the <code><head></code> section of the page, in a <code>window.onload</code> event handler: |
---|
29 | </p> |
---|
30 | <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>' );</pre> |
---|
31 | <p> |
---|
32 | Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of |
---|
33 | the <code><textarea></code> element to be replaced. |
---|
34 | </p> |
---|
35 | </div> |
---|
36 | |
---|
37 | <!-- This <div> holds alert messages to be display in the sample page. --> |
---|
38 | <div id="alerts"> |
---|
39 | <noscript> |
---|
40 | <p> |
---|
41 | <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript |
---|
42 | support, like yours, you should still see the contents (HTML data) and you should |
---|
43 | be able to edit it normally, without a rich editor interface. |
---|
44 | </p> |
---|
45 | </noscript> |
---|
46 | </div> |
---|
47 | <form action="sample_posteddata.php" method="post"> |
---|
48 | <p> |
---|
49 | <label for="editor1"> |
---|
50 | Editor 1:</label> |
---|
51 | <textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></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 | |
---|
67 | <p> |
---|
68 | <input type="submit" value="Submit" /> |
---|
69 | </p> |
---|
70 | </form> |
---|
71 | <div id="footer"> |
---|
72 | <hr /> |
---|
73 | <p> |
---|
74 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
---|
75 | </p> |
---|
76 | <p id="copy"> |
---|
77 | Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
---|
78 | Knabben. All rights reserved. |
---|
79 | </p> |
---|
80 | </div> |
---|
81 | </body> |
---|
82 | </html> |
---|
83 | |
---|