eWebEditor Home >> eWebEditor Manual V8.0 >> Developer Guide >> Code Examples

3.10.4 Client API

This example demonstrates how to use Client API provided by eWebEditor to realize interactive operation between client and editor.

To use this code normally, please set the path of "ewebeditor.htm" to eWebEditor's actual saving path.

This example is packed in the example directory of _example/clientapi.asp(.php/.aspx/.jsp) in compressed system package.

 

<HTML>

<HEAD>

<TITLE>eWebEditor : Demo of Client API</TITLE>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">

<link rel='stylesheet' type='text/css' href='example.css'>

</HEAD>

<BODY>

 

<p><b>Navigator : <a href="default.asp">Home</a> &gt; Demo of Client API</b></p>

<p>You can use Client API provided by eWebEditor to make advanced operation of the editor. More about API, please refer to Developer Manual.</p>

 

 

<FORM method="post" name="myform" action="retrieve.asp">

<TABLE border="0" cellpadding="2" cellspacing="1">

<TR>

       <TD>Content:</TD>

       <TD>

              <INPUT type="hidden" name="content1" value="&lt;p&gt;eWebEditor - Advanced online browser based HTML Editor.&lt;/p&gt;">

              <IFRAME ID="eWebEditor1" src="../ewebeditor.htm?id=content1&style=coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME>

       </TD>

</TR>

<TR>

       <TD colspan=2 align=right>

       <INPUT type=submit value="Submit">

       <INPUT type=reset value="Reset">

       <INPUT type=button value="View Source" onclick="location.replace('view-source:'+location)">

       </TD>

</TR>

<TR>

       <TD>HTML:</TD>

       <TD><TEXTAREA cols=50 rows=5 id=myTextArea style="width:550px"></TEXTAREA></TD>

</TR>

<TR>

       <TD colspan=2 align=right>

       <INPUT type=button value="getHTML" onclick="myTextArea.value=eWebEditor1.getHTML()">

       <INPUT type=button value="setHTML" onclick="eWebEditor1.setHTML('<b>Hello My World!</b>')">

       <INPUT type=button value="insertHTML" onclick="eWebEditor1.insertHTML('This is insertHTML function!')">

       <INPUT type=button value="appendHTML" onclick="eWebEditor1.appendHTML('This is appendHTML function!')">

       <br>

       <INPUT type=button value="Source Mode" onclick="eWebEditor1.setMode('CODE')">

       <INPUT type=button value="Edit Mode" onclick="eWebEditor1.setMode('EDIT')">

       <INPUT type=button value="Text Mode" onclick="eWebEditor1.setMode('TEXT')">

       <INPUT type=button value="Preview Mode" onclick="eWebEditor1.setMode('VIEW')">

       </TD>

</TR>

</TABLE>

</FORM>

 

 

</BODY>

</HTML>