GetDocument Function

Description

This function retrieves the entire contents of the EditLive! for XML applet. This function takes the name of a JavaScript function as its only parameter.

Syntax

JavaScript

GetDocument(strJSFunct,[blnUploadImages]);

Parameters

strJSFunct

This is a required parameter.

The name of the JavaScript function which receives the retrieved EditLive! for XML applet contents.

blnUploadImages

This is an optional parameter.

This is a boolean which indicates whether images should be uploaded to the server when this function is called. The uploading of images will occur immediately before the content is retrieved.

The default value is false.

Example

Example 17.2. GetDocument Runtime Function Example

The following code first creates a JavaScript function which is to be used as the parameter for the GetDocument function. The JavaScript function will save the retrieved contents to a <TEXTAREA> with the name documentContents. The GetDocument function will be associated with a HTML button. The name of the EditLive! for XML applet is editlivejs. Images in EditLive! for XML will be uploaded to the server when GetDocument is called.

<html>
  <head>
    <title>EditLive! for XML JavaScript Example</title>
    <!--Include the EditLive! for XML JavaScript Library-->
    <script src="editlivexml/editlivexml.js" language="JavaScript">
    </script>
    <script language="JavaScript">
      function retrieveDocument(src){
        document.exampleForm.documentContents.value = src;
      }
    </script>
  </head>
  <body>
    <form name="exampleForm">
      <p>EditLive! for XML contents will appear here</p>
      <!--Create a textarea to save the applet contents to-->
      <p><textarea name="documentContents" cols="40" rows="10">
</textarea></p>
      <p>Click this button to retrieve applet contents</p>
      <p><input type="button" name="button1" value="Retrieve Contents" 
onClick="editlivejs.GetDocument('retrieveDocument',true);"/></p>      
      <!--Create an instance of EditLive! for XML-->
      <script language="JavaScript">
        var editlivejs;
        editlivejs = new EditLiveXML("editlive",450 , 275);
        editlivejs.setDownloadDirectory("editlivexml");
        editlivejs.setLocalDeployment(false);
        editlivejs.setConfigurationFile("sample_elconfig.xml");
        editlivejs.setDocument(escape('<html><body><p>Some initial
text</p></body></html>'));
        editlivejs.show();
      </script>
    </form>
  </body>
</html>         

Remarks

When uploading locally stored images to the relevant Web server for an instance of EditLive! for XML ensure that the blnUploadImages parameter is set to true when calling the GetDocument function.