Page tree
Skip to end of metadata
Go to start of metadata

This property specifies the initial document body contents of the Ephox EditLive! applet. When setting this property it should be noted that, when provided with a document, only information between the <BODY> and </BODY> tags will be retrieved and placed into the instance of EditLive!. This property is mutually exclusive with the setDocument Method

Syntax

Visual Basic Script
object.Body = strBody
ASP.NET

This attribute no longer exists in the ASP.NET controls. Please use the Content property instead.

JavaScript
editliveInstance.setBody(strBody);

Parameters

strBody

A string specifying the initial document body contents of the EditLive! applet.

The default value is an empty string.

Examples

The following code would set the initial document body contents of EditLive! to be equal to Initial Contents of Ephox EditLive!. The <P> and </P> tags will not be seen in the window as they will be parsed as HTML. However, these tags will be visible in the Code View.

VBScript
editlive1.Body = "<P>Initial contents of Ephox EditLive!</P>"
JavaScript

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

editlive_js.setBody(encodeURIComponent("<P>Initial contents of Ephox EditLive!</P>"));

 

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

 <HTML>
   <HEAD>
      <TITLE>EditLive! for Java JavaScript Example</TITLE>
      <!--Include the EditLive! for Java JavaScript Library-->
      <SCRIPT src="editlivejava/editlivejava.js" language="JavaScript">
      </SCRIPT>
   </HEAD>
   <BODY>
      <FORM name = exampleForm>
         <P>EditLive! for Java contents will be loaded from here</P>
         <!--Create a textarea to load the applet contents from-->
         <P>
            <TEXTAREA name="bodyContents" cols="40" rows="10">
               <p>Content to be loaded</p>
            </TEXTAREA>
         </P>
         <P>Click this button to set applet contents</P>
         <P>
            <INPUT type="button"
               name="button1"
               value="Set Contents"
               onClick="editlive_js.SetBody(encodeURIComponent(document.exampleForm.bodyContents.value));">
         </P>
         <!--Create an instance of EditLive! for Java-->
         <SCRIPT language="JavaScript">
            var editlive_js;
            editlive_js = new EditLiveJava("editlive",450 , 275);
            editlive_js.setDownloadDirectory("editlivejava");
            editlive_js.setLocalDeployment(false);
            editlive_js.setConfigurationFile("sample_elconfig.xml");
            editlive_js.show();
         </SCRIPT>
      </FORM>
   </BODY>
</HTML>

Remarks

The Body property is mutually exclusive with the setDocument Method.

See Also

  • No labels