1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <!-- |
---|
3 | * FCKeditor - The text editor for internet |
---|
4 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
5 | * |
---|
6 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
7 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
8 | * |
---|
9 | * For further information visit: |
---|
10 | * http://www.fckeditor.net/ |
---|
11 | * |
---|
12 | * "Support Open Source software. What about a donation today?" |
---|
13 | * |
---|
14 | * File Name: sample03.html |
---|
15 | * Sample page. |
---|
16 | * |
---|
17 | * File Authors: |
---|
18 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
19 | --> |
---|
20 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
21 | <head> |
---|
22 | <title>FCKeditor - Sample</title> |
---|
23 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
24 | <meta name="robots" content="noindex, nofollow" /> |
---|
25 | <link href="../sample.css" rel="stylesheet" type="text/css" /> |
---|
26 | <script type="text/javascript" src="../../fckeditor.js"></script> |
---|
27 | <script type="text/javascript"> |
---|
28 | |
---|
29 | var bIsLoaded = false ; |
---|
30 | |
---|
31 | function FCKeditor_OnComplete( editorInstance ) |
---|
32 | { |
---|
33 | if ( bIsLoaded ) |
---|
34 | return ; |
---|
35 | |
---|
36 | var oCombo = document.getElementById( 'cmbLanguages' ) ; |
---|
37 | |
---|
38 | var aLanguages = new Array() ; |
---|
39 | |
---|
40 | for ( code in editorInstance.Language.AvailableLanguages ) |
---|
41 | aLanguages.push( { Code : code, Name : editorInstance.Language.AvailableLanguages[code] } ) ; |
---|
42 | |
---|
43 | aLanguages.sort( SortLanguage ) ; |
---|
44 | |
---|
45 | for ( var i = 0 ; i < aLanguages.length ; i++ ) |
---|
46 | AddComboOption( oCombo, aLanguages[i].Name + ' (' + aLanguages[i].Code + ')', aLanguages[i].Code ) ; |
---|
47 | |
---|
48 | oCombo.value = editorInstance.Language.ActiveLanguage.Code ; |
---|
49 | |
---|
50 | document.getElementById('eNumLangs').innerHTML = '(' + aLanguages.length + ' languages available!)' ; |
---|
51 | |
---|
52 | bIsLoaded = true ; |
---|
53 | } |
---|
54 | |
---|
55 | function SortLanguage( langA, langB ) |
---|
56 | { |
---|
57 | return ( langA.Name < langB.Name ? -1 : langA.Name > langB.Name ? 1 : 0 ) ; |
---|
58 | } |
---|
59 | |
---|
60 | function AddComboOption(combo, optionText, optionValue) |
---|
61 | { |
---|
62 | var oOption = document.createElement("OPTION") ; |
---|
63 | |
---|
64 | combo.options.add(oOption) ; |
---|
65 | |
---|
66 | oOption.innerHTML = optionText ; |
---|
67 | oOption.value = optionValue ; |
---|
68 | |
---|
69 | return oOption ; |
---|
70 | } |
---|
71 | |
---|
72 | function ChangeLanguage( languageCode ) |
---|
73 | { |
---|
74 | window.location.href = window.location.pathname + "?" + languageCode ; |
---|
75 | } |
---|
76 | </script> |
---|
77 | </head> |
---|
78 | <body> |
---|
79 | <h1> |
---|
80 | FCKeditor - JavaScript - Sample 3</h1> |
---|
81 | <div> |
---|
82 | This sample shows the editor in all its available languages. |
---|
83 | </div> |
---|
84 | <hr /> |
---|
85 | <table cellpadding="0" cellspacing="0" border="0"> |
---|
86 | <tr> |
---|
87 | <td> |
---|
88 | Select a language: |
---|
89 | </td> |
---|
90 | <td> |
---|
91 | <select id="cmbLanguages" onchange="ChangeLanguage(this.value);"> |
---|
92 | </select> |
---|
93 | </td> |
---|
94 | <td> |
---|
95 | <span id="eNumLangs"></span> |
---|
96 | </td> |
---|
97 | </tr> |
---|
98 | </table> |
---|
99 | <br /> |
---|
100 | <form action="sampleposteddata.asp" method="post" target="_blank"> |
---|
101 | <script type="text/javascript"> |
---|
102 | <!-- |
---|
103 | // Automatically calculates the editor base path based on the _samples directory. |
---|
104 | // This is usefull only for these samples. A real application should use something like this: |
---|
105 | // oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. |
---|
106 | var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ; |
---|
107 | |
---|
108 | var sLang ; |
---|
109 | if ( document.location.search.length > 1 ) |
---|
110 | sLang = document.location.search.substr(1) ; |
---|
111 | |
---|
112 | var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ; |
---|
113 | oFCKeditor.BasePath = sBasePath ; |
---|
114 | if ( sLang == null ) |
---|
115 | { |
---|
116 | oFCKeditor.Config["AutoDetectLanguage"] = true ; |
---|
117 | oFCKeditor.Config["DefaultLanguage"] = "en" ; |
---|
118 | } |
---|
119 | else |
---|
120 | { |
---|
121 | oFCKeditor.Config["AutoDetectLanguage"] = false ; |
---|
122 | oFCKeditor.Config["DefaultLanguage"] = sLang ; |
---|
123 | } |
---|
124 | oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.' ; |
---|
125 | oFCKeditor.Create() ; |
---|
126 | //--> |
---|
127 | </script> |
---|
128 | <br /> |
---|
129 | <input type="submit" value="Submit" /> |
---|
130 | </form> |
---|
131 | </body> |
---|
132 | </html> |
---|