1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <!-- |
---|
3 | Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. |
---|
4 | For licensing, see LICENSE.html or http://ckeditor.com/license |
---|
5 | --> |
---|
6 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
7 | <head> |
---|
8 | <title>Replace Textareas by Class Name — CKEditor Sample</title> |
---|
9 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
---|
10 | <script type="text/javascript" src="/ckeditor_3.6.5/ckeditor/ckeditor.js"></script> |
---|
11 | <script type="text/javascript"> |
---|
12 | if ( window.CKEDITOR ) |
---|
13 | { |
---|
14 | (function() |
---|
15 | { |
---|
16 | var showCompatibilityMsg = function() |
---|
17 | { |
---|
18 | var env = CKEDITOR.env; |
---|
19 | |
---|
20 | var html = '<p><strong>Your browser is not compatible with CKEditor.</strong>'; |
---|
21 | |
---|
22 | var browsers = |
---|
23 | { |
---|
24 | gecko : 'Firefox 2.0', |
---|
25 | ie : 'Internet Explorer 6.0', |
---|
26 | opera : 'Opera 9.5', |
---|
27 | webkit : 'Safari 3.0' |
---|
28 | }; |
---|
29 | |
---|
30 | var alsoBrowsers = ''; |
---|
31 | |
---|
32 | for ( var key in env ) |
---|
33 | { |
---|
34 | if ( browsers[ key ] ) |
---|
35 | { |
---|
36 | if ( env[key] ) |
---|
37 | html += ' CKEditor is compatible with ' + browsers[ key ] + ' or higher.'; |
---|
38 | else |
---|
39 | alsoBrowsers += browsers[ key ] + '+, '; |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | alsoBrowsers = alsoBrowsers.replace( /\+,([^,]+), $/, '+ and $1' ); |
---|
44 | |
---|
45 | html += ' It is also compatible with ' + alsoBrowsers + '.'; |
---|
46 | |
---|
47 | html += '</p><p>With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.</p>'; |
---|
48 | |
---|
49 | var alertsEl = document.getElementById( 'alerts' ); |
---|
50 | alertsEl && ( alertsEl.innerHTML = html ); |
---|
51 | }; |
---|
52 | |
---|
53 | var onload = function() |
---|
54 | { |
---|
55 | CKEDITOR.instances['editor1'].on('instanceReady', function(evt) { |
---|
56 | evt.editor.focus(); |
---|
57 | }); |
---|
58 | // Show a friendly compatibility message as soon as the page is loaded, |
---|
59 | // for those browsers that are not compatible with CKEditor. |
---|
60 | if ( !CKEDITOR.env.isCompatible ) |
---|
61 | showCompatibilityMsg(); |
---|
62 | }; |
---|
63 | |
---|
64 | // Register the onload listener. |
---|
65 | if ( window.addEventListener ) |
---|
66 | window.addEventListener( 'load', onload, false ); |
---|
67 | else if ( window.attachEvent ) |
---|
68 | window.attachEvent( 'onload', onload ); |
---|
69 | })(); |
---|
70 | } |
---|
71 | </script> |
---|
72 | </head> |
---|
73 | <body> |
---|
74 | <form action="sample_posteddata.php" method="post"> |
---|
75 | <p> |
---|
76 | <label for="editor1"> |
---|
77 | Editor 1:</label> |
---|
78 | <textarea class="ckeditor" 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> |
---|
79 | </p> |
---|
80 | <p> |
---|
81 | <input type="submit" value="Submit" /> |
---|
82 | </p> |
---|
83 | </form> |
---|
84 | </body> |
---|
85 | </html> |
---|