There are several methods in which XHTML content can be loaded into an instance of the EditLive! applet:
- Using the Open Menu and Toolbar Items
- Using the setDocument Method
- Using the setBody Method
There are a variety of methods that can be used to set the CSS style information for an instance of EditLive!. For more information on how to set the CSS information for an instance of EditLive!, please see the Using CSS in the Applet article.
Using the Open Menu and Toolbar Items
Using the EditLive! Configuration File, developers can specify the Open dialog to be accessed via either a menu item or toolbar button. This dialog allows users to specify an XHTML document load into an instance of EditLive!.
These menu and/or toolbar items can added to an EditLive! Configuration File by manually editing the configuration file. If manually editing a configuration file, see the Menu and Toolbar Item List, <menuItem>, and <toolbarButton> sections of this SDK.
Using the Document Load Time Property
The setDocument Method allows the developer to specify an entire XHTML document to load into EditLive!. The XHTML document is passed to the Document load time property as a URL encoded string.
Example
The following example depicts loading a simple XHTML document into an instance of EditLive! using the Document load time property. Note the use of the Javascript encodeURIComponent function to encode the XHTML content.
To ensure the most reliable URL encoding when encoding content for the setDocument Method, you should use the URL encoding method provided by your server-side language. For a list of available URL encoding methods for a variety of server-side languages, see the Encoding Content article.
<script src="../../redistributables/editlivejava/editlivejava.js"></script> <script language="JavaScript"> var editlivejava1; editlivejava1 = new EditLiveJava("ELApplet1", "700", "400"); ... editlivejava1.setDocument(encodeURIComponent("<html><body><p>Test Content</p></body></html>")); ... editlivejava1.show(); </script>
Using the Body Load Time Property
The setBody Method allows the developer to specify only the content to be loaded between the XHTML <body> tag in EditLive!. The XHTML content is passed to the Body load time property as a URL encoded string.
Example
The following example depicts loading simple XHTML content into the <body> tag of an instance of EditLive!, using the Body load time property. Note the use of the Javascript encodeURIComponent function to encode the XHTML content.
To ensure the most reliable URL encoding when encoding content for the Body load time property, you should use the URL encoding method provided by your server-side language. For a list of available URL encoding methods for a variety of server-side languages, see the Encoding Content article.
<script src="../../redistributables/editlivejava/editlivejava.js"></script> <script language="JavaScript"> var editlivejava1; editlivejava1 = new EditLiveJava("ELApplet1", "700", "400"); ... editlivejava1.setBody(encodeURI("<p>Test Content</p>")); ... editlivejava1.show(); </script>