1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
* Copyright (C) 2003-2008 Frederico Caldeira Knabben
8
* Licensed under the terms of any of the following licenses at your
11
* - GNU General Public License Version 2 or later (the "GPL")
12
* http://www.gnu.org/licenses/gpl.html
14
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15
* http://www.gnu.org/licenses/lgpl.html
17
* - Mozilla Public License Version 1.1 or later (the "MPL")
18
* http://www.mozilla.org/MPL/MPL-1.1.html
24
<html xmlns="http://www.w3.org/1999/xhtml">
26
<title>FCKeditor - Sample</title>
27
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28
<meta name="robots" content="noindex, nofollow" />
29
<link href="../sample.css" rel="stylesheet" type="text/css" />
30
<script type="text/javascript" src="../../fckeditor.js"></script>
31
<script type="text/javascript">
33
var bIsLoaded = false ;
35
function FCKeditor_OnComplete( editorInstance )
40
var oCombo = document.getElementById( 'cmbLanguages' ) ;
42
// Remove all options. (#1399)
43
oCombo.innerHTML = '' ;
45
var aLanguages = new Array() ;
47
for ( code in editorInstance.Language.AvailableLanguages )
48
aLanguages.push( { Code : code, Name : editorInstance.Language.AvailableLanguages[code] } ) ;
50
aLanguages.sort( SortLanguage ) ;
52
for ( var i = 0 ; i < aLanguages.length ; i++ )
53
AddComboOption( oCombo, aLanguages[i].Name + ' (' + aLanguages[i].Code + ')', aLanguages[i].Code ) ;
55
oCombo.value = editorInstance.Language.ActiveLanguage.Code ;
57
document.getElementById('eNumLangs').innerHTML = '(' + aLanguages.length + ' languages available!)' ;
62
function SortLanguage( langA, langB )
64
return ( langA.Name < langB.Name ? -1 : langA.Name > langB.Name ? 1 : 0 ) ;
67
function AddComboOption(combo, optionText, optionValue)
69
var oOption = document.createElement("OPTION") ;
71
combo.options.add(oOption) ;
73
oOption.innerHTML = optionText ;
74
oOption.value = optionValue ;
79
function ChangeLanguage( languageCode )
81
document.location.href = document.location.href.replace( /\?.*$/, '' ) + "?" + languageCode ;
87
FCKeditor - JavaScript - Sample 3</h1>
89
This sample shows the editor in all its available languages.
92
<table cellpadding="0" cellspacing="0" border="0">
95
Select a language:
98
<select id="cmbLanguages" onchange="ChangeLanguage(this.value);">
99
<option> </option>
103
<span id="eNumLangs"></span>
108
<form action="../php/sampleposteddata.php" method="post" target="_blank">
109
<script type="text/javascript">
111
// Automatically calculates the editor base path based on the _samples directory.
112
// This is usefull only for these samples. A real application should use something like this:
113
// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
114
var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples')) ;
117
if ( document.location.search.length > 1 )
118
sLang = document.location.search.substr(1) ;
120
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
121
oFCKeditor.BasePath = sBasePath ;
124
oFCKeditor.Config["AutoDetectLanguage"] = true ;
125
oFCKeditor.Config["DefaultLanguage"] = "en" ;
129
oFCKeditor.Config["AutoDetectLanguage"] = false ;
130
oFCKeditor.Config["DefaultLanguage"] = sLang ;
132
oFCKeditor.Value = '<p>This is some <strong>sample text<\/strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor<\/a>.<\/p>' ;
133
oFCKeditor.Create() ;
137
<input type="submit" value="Submit" />