EditLive! 9 Documentation : setBody Method (Run Time)

This method sets the contents of the EditLive! applet between the <BODY> tags. It will replace any existing contents of the applet with the contents the function is provided with as its parameter. This method takes a JavaScript string as its only parameter. 





The string representing the contents to be placed into the EditLive! applet between the <BODY> tags.


The following code creates a <TEXTAREA>, named bodyContents, that will have its contents loaded into an instance of EditLive! via the setBody method. The setBody method will be associated with a HTML button. The name of the EditLive! applet is editlive_js.

      <TITLE>EditLive! JavaScript Example</TITLE>
      <!--Include the EditLive! JavaScript Library-->
      <SCRIPT src="editlivejava/editlivejava.js" language="JavaScript">
      <FORM name = exampleForm>
         <P>EditLive! contents will be loaded from here</P>
         <!--Create a textarea to load the applet contents from-->
            <TEXTAREA name="bodyContents" cols="40" rows="10">
               <p>Content to be loaded</p>
         <P>Click this button to set applet contents</P>
            <INPUT type="button"
               value="Set Contents"
         <!--Create an instance of EditLive!-->
         <SCRIPT language="JavaScript">
            var editlive_js = new EditLiveJava("editlive", 450, 275);

The string passed to the JavaScript setBody method must be URL encoded. It is recommended that a server-side URL encoding function be used if available as the JavaScript encodeURI function does not fully comply with the URL encoding standard.

See Also