|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: 009.html
* Test page.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="testcases.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../fckeditor.js"></script>
<script>
function FCKeditor_OnComplete( editorInstance )
{
// Attach to the event fired when the editor's HTML is set.
editorInstance.Events.AttachEvent( 'OnAfterSetHTML', FCKeditor_OnAfterSetHTML ) ;
}
function FCKeditor_OnAfterSetHTML( editorInstance )
{
// Get the actual color from the combo.
var sColor = document.getElementById('ActualColor').value ;
// Set the color of the editor instance.
editorInstance.EditorDocument.body.style.backgroundColor = sColor ;
}
function SetActualColor()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
// Call the event function to set the color.
FCKeditor_OnAfterSetHTML( oEditor ) ;
}
</script>
</head>
<body>
<h1>FCKeditor - Test 009</h1>
<P>
<STRONG>Expected results</STRONG> : The user should be able to background color
of the editor by code.<BR>
<STRONG>Configurations</STRONG>: Default<BR>
<STRONG>Steps to Reproduce</STRONG>:
</P>
<OL>
<LI>
Wait the editor to load.
<LI>
Type some text.
<LI>
Change the background color using the combo.
<LI>
Type more text.
<LI>
Switch to source view.
<LI>
Switch back to WYSIWYG. The background color must be the same.
<LI>
Repeate steps 3 to 6.
<LI>
Submit the form.</LI></OL>
<P>
<hr>
<P>
Select a color for the background:<br>
<select id="ActualColor" onchange="SetActualColor();">
<option value="white" selected>White</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="gold">Gold</option>
</select>
</P>
<form action="sampleposteddata.asp" method="post" target="_blank">
<script type="text/javascript">
<!--
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_testcases')) ;
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.' ;
oFCKeditor.Create() ;
//-->
</script>
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Todd Davis has been working in web and application development for several years, using Silverlight, ASP.NET, VB.NET, C#, C++ and Javascript, as well as a great deal of work with SQL server and IIS.
He currently works for Virtual Radiologic in Eden Prairie, MN, however he is better known for his varied work in the open source community, especially the DotNetNuke project for which he provided several world-renowned training videos and modules. A huge advocate of open source and open knowledge sharing, everything on his website (www.SeaburyDesign.com) is always offered for free.
Whenever he is not actively coding at his laptop (a rarity to be sure), he can be found woodworking, walking with his wife and kids, or motoring along the back roads of MN on his Harley Davidson Fatboy.