3.6.2.4 EWEBEDITOR.Replace Method
Functional Description:
Replace the specified <INPUT> or <TEXTAREA> or <DIV> by an editor instance. The contents of the original object will be automatically assigned to the editor as the initial value. If the editor is deleted, the editorial contents within the editor will return to the original object.
Method prototype:
EWEBEDITOR.Replace(s_Id, o_Config)
Parameters Description:
Parameters |
Types |
Required |
Explanation |
s_Id |
string |
Yes |
The id or name of <INPUT> or <TEXTAREA> which need to be replaced, the id of <DIV> ,this id will also be used in the instantiated id. |
o_Config |
object |
No |
Editor instance configuration, if it doesn't set, you can take settings of EWBEDITOR.Config, structures please see the specific explanations in the [objects of EWEBEDITOR.Config] chapter. |
Return Value:
Back to the object of EWEBEDITOR.editor, which is a reference to the instantiated editor, after loading, you can use the interface methods of the editor objects.
Sample Code:
<textarea id="textarea1">Initial Value</textarea> <script type="text/javascript"> var editor = EWEBEDITOR.Replace("textarea1", {style:"coolblue", width:"550", height:"350"}); </script> |
<textarea name="textarea1">Initial Value</textarea> <script type="text/javascript"> var editor = EWEBEDITOR.Replace("textarea1", {style:"coolblue", width:"550", height:"350"}); </script> |
<div id="div1">Initial Value</div> <script type="text/javascript"> var editor = EWEBEDITOR.Replace("div1", {style:"coolblue", width:"550", height:"350"}); // var editor = EWEBEDITOR.Instances["div1"]; </script> |