Ticket #11761: replacebycode3.html

File replacebycode3.html, 2.7 KB (added by Jakub Ś, 10 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-2013, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.html or http://ckeditor.com/license
5-->
6<html>
7<head>
8        <title>Replace Textarea by Code &mdash; CKEditor Sample</title>                 
9        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />   
10        <script src="../ckeditor.js" ></script>
11        <link href="sample.css" rel="stylesheet">
12</head>
13<body>
14        <h1 class="samples">
15                <a href="index.html">CKEditor Samples</a> &raquo; Replace Textarea Elements Using JavaScript Code
16        </h1>
17        <form action="sample_posteddata.php" method="post"> <!-- accept-charset="windows-1252" -->
18                <div class="description">
19                        <p>
20                                This editor is using an <code>&lt;iframe&gt;</code> element-based editing area, provided by the <strong>Wysiwygarea</strong> plugin.
21                        </p>
22<pre class="samples">
23
24CKEDITOR.replace( '<em>textarea_id</em>' )
25</pre>
26                </div>
27               
28                <select id="moo">
29                        <option value="x">change me!</option>
30                        <option value="y">to something else!</option>   
31                </select>
32
33                <button id="d1">Destroy1</button>
34                <button id="d2">Destroy2</button>
35
36                <button id="i1">Init1</button>
37                <button id="i2">Init2</button>
38
39                <textarea id="editor1">Hello1!</textarea>   
40
41                <textarea id="editor2">Hello2!</textarea>   
42
43                <script>
44                        function init1() {
45                        CKEDITOR.replace( 'editor1', {
46                                //plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar'
47                                } );
48                        }
49                        function init2() {
50                                CKEDITOR.replace( 'editor2', {
51                                        //plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar'
52                                } );
53                        }
54
55                        CKEDITOR.document.getById( 'moo' ).on( 'change', function() {
56                                console.log( 'select changed!' );
57                        } );
58                        document.getElementById( 'moo' ).onchange = function() {
59                                console.log( 'changing natively...' );
60                        };
61
62                        document.getElementById( 'd1' ).onclick = function() {
63                                CKEDITOR.instances.editor1.destroy();
64                                return false;
65                        };
66                        document.getElementById( 'd2' ).onclick = function() {
67                                CKEDITOR.instances.editor2.destroy();
68                                return false;
69                        };
70                        document.getElementById( 'i1' ).onclick = init1;
71                        document.getElementById( 'i2' ).onclick = init2;
72
73                        init1();
74                        init2();
75                       
76                       
77
78                </script>
79                <p>
80                        <input type="submit" value="Submit">
81                </p>
82        </form>
83        <div id="footer">
84                <hr>
85                <p>
86                        CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
87                </p>
88                <p id="copy">
89                        Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
90                        Knabben. All rights reserved.
91                </p>
92        </div>
93</body>
94</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy