# CKEditor Samples List for ASP — CKEditor Sample

## Overview

The ckeditor.asp file provides a wrapper to ease the work of creating CKEditor instances from classic Asp.

To use it, you must first include it into your page: `<!-- #INCLUDE file="../../ckeditor.asp" -->` Of course, you should adjust the path to make it point to the correct location, and maybe use a full path (with virtual="" instead of file="")

After that script is included, you can use it in different ways, based on the following pattern:

1. Create an instance of the CKEditor class:

       dim editor
       set editor = New CKEditor

2. Set the path to the folder where CKEditor has been installed, by default it will use /ckeditor/

       editor.basePath = "../../"

3. Now use one of the three main methods to create the CKEditor instances:
   - Replace textarea with id (or name) "editor1".

         editor.replaceInstance "editor1"

   - Replace all textareas with CKEditor.

         editor.replaceAll empty

   - Create a textarea element and attach CKEditor to it.

         editor.editor "editor1", initialValue

Before step 3 you can use a number of methods and properties to adjust the behavior of this class and the CKEditor instances that will be created:

- returnOutput : if set to true, the functions won't dump the code with response.write, but instead they will return it so you can do anything you want
- basePath: location of the CKEditor scripts
- initialized: if you set it to true, it means that you have already included the CKEditor.js file into the page and it doesn't have to be generated again.
- textareaAttributes: You can set here a Dictionary object with the attributes that you want to output in the call to the "editor" method.
- config: Allows to set config values for all the instances from now on.
- instanceConfig: Allows to set config values just for the next instance.
- addEventHandler: Adds an event handler for all the instances from now on.
- addInstanceEventHandler: Adds an event handler just for the next instance.
- addGlobalEventHandler: Adds an event handler for the global CKEDITOR object.
- clearEventHandlers: Removes one or all the event handlers from all the instances from now on.
- clearInstanceEventHandlers: Removes one or all the event handlers from the next instance.
- clearGlobalEventHandlers: Removes one or all the event handlers from the global CKEDITOR object.

## Basic Samples

- Replace existing textareas by code
- Replace all textareas by code
- Create instances in asp

## Advanced Samples

- Advanced example
- Listening to events