To create an instance of the editor embedded into a web page, the object element must be used. The following sample code will create an instance of the editor that fills the current browser window.
<object id="richedit" style="BACKGROUND-COLOR: buttonface" data="richedit.html" width="100%" height="100%" type="text/x-scriptlet" VIEWASTEXT> </object>
The id="richedit" is used to allow control of the editor object from JavaScript. The data="richedit.html" identifies the source for the editor object. The path specified in the data attribute should point to where the richtext editor is installed on your server.
Having created an instance of the richtext editor object, it's properties and methods can be accessed through the id assigned to is (richedit in our example). This object has a public interface comprising of methods and properties.
Properties |
||||||||||||||||||||||||||||||||||||||||||||||
Name | Access | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
docHtml | Read/Write | This property is used feed and extract the HTML being edited. When read, this property returns the current contents of the document (HTML) being edited. When written to, the contents of the editor window are replaced with the supplied HTML. | ||||||||||||||||||||||||||||||||||||||||||||
options | Read/Write | This property is used to enable/disable features of the editor @
runtime. More features are being made optional through this property.
The property is similar in syntax to the window options of the window.open() method of the W3C DOM. It comprises a semicolon separated list of name=value pairs. The names are case insensitive as are the values (unless otherwise specified). An example use of the options property might be:
There are several levels of options, some options disable a toolbar of features whilst others disable individual features. The following table will describe each option in turn:
|
||||||||||||||||||||||||||||||||||||||||||||
Methods |
||||||||||||||||||||||||||||||||||||||||||||||
addField | ||||||||||||||||||||||||||||||||||||||||||||||