This function sets the contents of the EditLive! for XML applet. It will replace any existing contents of the applet with the contents the function is provided with as its parameter. This function takes a JavaScript string as its only parameter.
A string of the contents to be placed into the EditLive! for XML applet.
This string must be URL encoded. It is recommended that this encoding is done via a server-side URL encodingmethod. Encoding can be achieved using the JavaScript escape function, however, this is not recommended as the escape function does not fully comply with the URL encoding standards.
Example 17.9. SetDocument Runtime Function Example
The following code creates a <TEXTAREA>, named documentContents, that will have its contents loaded into an instance of EditLive! for XML via the SetDocument function. The SetDocument function will be associated with a HTML button. The name of the EditLive! for XML applet is editlivejs.
<HTML>
<HEAD>
<TITLE>EditLive! for XML JavaScript Example</TITLE>
<!--Include the EditLive! for XML JavaScript Library-->
<SCRIPT src="editlivexml/editlivexml.js" language="JavaScript"></SCRIPT>
</HEAD>
<BODY>
<FORM name = exampleForm>
<P>EditLive! for XML contents will be loaded from here</P>
<!--Create a textarea to load the applet contents from-->
<P>
<TEXTAREA name="documentContents" cols="40" rows="10">
<html><body><p>Content to be
loaded</p></body></html>
</TEXTAREA>
<P>Click this button to set applet contents</P>
<INPUT
type="button" name="button1" value="Set Contents"
onClick="editlivejs.SetDocument(escape(
document.exampleForm.documentContents.value));">
</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_config.xml");
editlivejs.show();
-->
</SCRIPT>
</FORM>
</BODY>
</HTML> Copyright 2001-2005 Ephox Corporation. All Rights Reserved.