EditLive! 9 Documentation : setOnInitComplete Method

This property can be used to call a JavaScript function once EditLive! has finished loading. Once EditLive! has finished loading, the JavaScript function defined by the OnInitComplete property is used as a callback. 

Syntax

Visual Basic Script
object.OnInitComplete = strCallBack
ASP.NET
prefix:EditLiveJava OnInitComplete = strCallBack
JavaScript
editliveInstance.setOnInitComplete(strCallBack);
editliveInstance.setOnInitComplete(fnCallback);

Parameters

strCallback

A string specifying the name of a JavaScript function to use as the callback function once EditLive! has finished loading.

fnCallback

A Javascript Function to call once EditLive! has finished loading.

In EditLive! 8.0 and above, the callback is called much earlier than in previous versions. In EditLive! 8.0, the callback is called as soon as the EditLive! run-time API is available, which may be before the EditLive! applet is loaded. In previous versions, the callback was fired when the applet was loaded.

Examples

The following code provides the JavaScript callback function which will set the body content of EditLive! once the applet has finished loading. The callback function is named AppletLoaded. This callback function will set the content of EditLive! to Body content set at runtime. The name of the EditLive! Applet JavaScript object is ELApplet1_js.

The AppletLoaded function below uses the setDocument Method (Run Time) to set the body content of EditLive!. The string used to set the body content in this example is URL encoded.

<script type='text/javascript'>
   function AppletLoaded(){
      ELApplet1_js.setDocument("%3Cp%3ESet+content+at+runtime%3C%2Fp%3E");
   }
</script>

The following example instantiates a version of EditLive! and assigns a function to be used as a callback once it has finished loading. The callback used in the example code is AppletLoaded which is described by the code above.

VBScript
<%
   ...
   editlive1.Name = "ELApplet1"
   editlive1.OnInitComplete = "AppletLoaded"
   editlive1.Show()
%>
ASP.NET Server Control
<elj:EditLiveJava Name="ELApplet1"
    OnInitComplete="AppletLoaded" 
/>
JavaScript
var ELApplet1_js = new EditLiveJava("ELApplet1", "700", "400");
ELApplet1_js.setOnInitComplete(AppletLoaded);