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 - http://www.fckeditor.net 4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 5 * 6 * == BEGIN LICENSE == 7 * 8 * Licensed under the terms of any of the following licenses at your 9 * choice: 10 * 11 * - GNU General Public License Version 2 or later (the "GPL") 12 * http://www.gnu.org/licenses/gpl.html 13 * 14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 15 * http://www.gnu.org/licenses/lgpl.html 16 * 17 * - Mozilla Public License Version 1.1 or later (the "MPL") 18 * http://www.mozilla.org/MPL/MPL-1.1.html 19 * 20 * == END LICENSE == 21 * 22 * Sample page. 23--> 24<html xmlns="http://www.w3.org/1999/xhtml"> 25<head> 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"> 32 33var bIsLoaded = false ; 34 35function FCKeditor_OnComplete( editorInstance ) 36{ 37 if ( bIsLoaded ) 38 return ; 39 40 var oCombo = document.getElementById( 'cmbLanguages' ) ; 41 42 var aLanguages = new Array() ; 43 44 for ( code in editorInstance.Language.AvailableLanguages ) 45 aLanguages.push( { Code : code, Name : editorInstance.Language.AvailableLanguages[code] } ) ; 46 47 aLanguages.sort( SortLanguage ) ; 48 49 for ( var i = 0 ; i < aLanguages.length ; i++ ) 50 AddComboOption( oCombo, aLanguages[i].Name + ' (' + aLanguages[i].Code + ')', aLanguages[i].Code ) ; 51 52 oCombo.value = editorInstance.Language.ActiveLanguage.Code ; 53 54 document.getElementById('eNumLangs').innerHTML = '(' + aLanguages.length + ' languages available!)' ; 55 56 bIsLoaded = true ; 57} 58 59function SortLanguage( langA, langB ) 60{ 61 return ( langA.Name < langB.Name ? -1 : langA.Name > langB.Name ? 1 : 0 ) ; 62} 63 64function AddComboOption(combo, optionText, optionValue) 65{ 66 var oOption = document.createElement("OPTION") ; 67 68 combo.options.add(oOption) ; 69 70 oOption.innerHTML = optionText ; 71 oOption.value = optionValue ; 72 73 return oOption ; 74} 75 76function ChangeLanguage( languageCode ) 77{ 78 window.location.href = window.location.pathname + "?" + languageCode ; 79} 80 </script> 81</head> 82<body> 83 <h1> 84 FCKeditor - JavaScript - Sample 3</h1> 85 <div> 86 This sample shows the editor in all its available languages. 87 </div> 88 <hr /> 89 <table cellpadding="0" cellspacing="0" border="0"> 90 <tr> 91 <td> 92 Select a language: 93 </td> 94 <td> 95 <select id="cmbLanguages" onchange="ChangeLanguage(this.value);"> 96 <option> </option> 97 </select> 98 </td> 99 <td> 100 <span id="eNumLangs"></span> 101 </td> 102 </tr> 103 </table> 104 <br /> 105 <form action="sampleposteddata.asp" method="post" target="_blank"> 106 <script type="text/javascript"> 107<!-- 108// Automatically calculates the editor base path based on the _samples directory. 109// This is usefull only for these samples. A real application should use something like this: 110// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. 111var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ; 112 113var sLang ; 114if ( document.location.search.length > 1 ) 115 sLang = document.location.search.substr(1) ; 116 117var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ; 118oFCKeditor.BasePath = sBasePath ; 119if ( sLang == null ) 120{ 121 oFCKeditor.Config["AutoDetectLanguage"] = true ; 122 oFCKeditor.Config["DefaultLanguage"] = "en" ; 123} 124else 125{ 126 oFCKeditor.Config["AutoDetectLanguage"] = false ; 127 oFCKeditor.Config["DefaultLanguage"] = sLang ; 128} 129oFCKeditor.Value = '<p>This is some <strong>sample text<\/strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor<\/a>.<\/p>' ; 130oFCKeditor.Create() ; 131//--> 132 </script> 133 <br /> 134 <input type="submit" value="Submit" /> 135 </form> 136</body> 137</html> 138