| 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <script src="ckeditor/ckeditor.js"></script> |
|---|
| 4 | <style type="text/css"> |
|---|
| 5 | div { |
|---|
| 6 | margin-bottom: 20px; |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | #col1 { |
|---|
| 10 | width: 50%; |
|---|
| 11 | float: left; |
|---|
| 12 | } |
|---|
| 13 | |
|---|
| 14 | #col2 { |
|---|
| 15 | width: 50%; |
|---|
| 16 | float: right; |
|---|
| 17 | } |
|---|
| 18 | </style> |
|---|
| 19 | </head> |
|---|
| 20 | <body> |
|---|
| 21 | <div> |
|---|
| 22 | <button id="switch">Switch editor container</button> |
|---|
| 23 | </div> |
|---|
| 24 | <div id="col1"> |
|---|
| 25 | <div id="editor"> |
|---|
| 26 | <textarea name="editor1"></textarea> |
|---|
| 27 | <script> |
|---|
| 28 | CKEDITOR.replace("editor1"); |
|---|
| 29 | </script> |
|---|
| 30 | </div> |
|---|
| 31 | </div> |
|---|
| 32 | <div id="col2"> |
|---|
| 33 | </div> |
|---|
| 34 | |
|---|
| 35 | <script type="text/javascript"> |
|---|
| 36 | var button = document.getElementById("switch"), |
|---|
| 37 | cont1 = document.getElementById("col1"), |
|---|
| 38 | cont2 = document.getElementById("col2"), |
|---|
| 39 | editor = document.getElementById("editor"); |
|---|
| 40 | |
|---|
| 41 | button.addEventListener("click", function(event) { |
|---|
| 42 | var currentContainer = editor.parentNode, |
|---|
| 43 | nextContainer = currentContainer == cont1 ? cont2 : cont1; |
|---|
| 44 | |
|---|
| 45 | nextContainer.appendChild(editor); |
|---|
| 46 | }); |
|---|
| 47 | </script> |
|---|
| 48 | </body> |
|---|
| 49 | </html> |
|---|