• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Electric Toolbox Blog

The Electric Toolbox Blog

Linux, Apache, Nginx, MySQL, Javascript and PHP articles

  • Applications
  • FCKEditor
  • Apache
  • Windows
  • Contact Us
Home / Write content into a dynamic Javascript popup from FCKEditor

Write content into a dynamic Javascript popup from FCKEditor

In response to a question asked on my “Count the words in an FCKeditor instance with Javascript” post about how to get the content from an FCKEditor instance and load it into a popup window, I posted “Write content into a dynamic Javascript popup” to show how to do this for any content. In this post I now show how to do this specifically for an FCKEditor instance.

Working example

Type some content into the FCKEditor below and then click the “Write to popup” button. A popup window will appear with the content from the editor. This is entirely browser based and does not require a trip back to the server to load another page.

Note that if you are viewing this post in a feed reader or email you will need to click through to view this page in a web browser for the example below to work.


How it works

Here’s the code to make the above work. This is a combination of the code on the write content into a dynamic Javascript popup and get the HTML from an FCKEditor instance posts.

var FCKeditor = FCKeditorAPI.GetInstance('FCKeditorExample');
var w = window.open('', '', 'width=600,height=400,resizeable,scrollbars');
w.document.write(FCKeditor.GetData());
w.document.close(); // needed for chrome and safari

FCKEditorExample is the name of the FCKEditor instance, and in the above example it was created with Javascript like so:

var FCKeditor = new FCKeditor('FCKeditorExample');
FCKeditor.ToolbarSet = "Basic";
FCKeditor.BasePath = "/examples/fckeditor/";
FCKeditor.Height = "100";
FCKeditor.Create();

Styling in the popup window

Writing the FCKEditor instance HTML into the popup won’t obviously contain any CSS styling (unless it is contained inline in the HTML) so if you need to add this as well, then add additional w.document.write lines to add the CSS or external style sheets.

Check Out These Related posts:

  1. Using the FCKEditor HTML Editor with PHP
  2. Insert HTML into FCKEditor
  3. Count the words in an FCKeditor instance with Javascript
  4. Write content into a dynamic Javascript popup

Filed Under: FCKEditor, Javascript

Primary Sidebar

Categories

  • Apache
  • Applications
  • Article
  • Case Studies
  • Email Servers
  • FCKEditor
  • HTML And CSS
  • Javascript
  • Linux/Unix/BSD
  • Microsoft SQL Server
  • Miscellaneous Postings
  • MySql
  • Networking
  • Nginx Web Server
  • Offsite Articles
  • OSX
  • PHP
  • Quick Tips
  • RFC – Request for Comments
  • SilverStripe
  • VMWare
  • VPN
  • Windows
  • WordPress

Recent Posts

  • Vim Show Line Numbers
  • Add User To Group Linux
  • Chmod 777 Tutorial
  • How to Copy Directory Linux
  • Linux create user

Copyright © 2021. ElectricToolBox. All Rights Reserved.

  • Contact Us
  • Copyright Info
  • Privacy Policy
  • Sitemap