<!-- ****************************************************** getDocument.html -- This tutorial shows developers how to extract the HTML Document stored in EditLive! and display this HTML in a webpage field. Copyright © 2001-2006 Ephox Corporation. All rights reserved. See license.txt for license agreement ****************************************************** --> <html> <head> <title>Tutorial - Getting the Editor's HTML Document</title> <link rel="stylesheet" href="stylesheet.css"> <!-- Include the EditLive! JavaScript Library --> <script src="../../redistributables/editlivejava/editlivejava.js" language="JavaScript"></script> </head> <body> <h1>Getting the Editor's HTML Document</h1> <form name="exampleForm"> <p>This tutorial shows how to extract the contents of the HTML Document in EditLive! and display this HTML in a textarea on the webpage.</p> <!-- The textarea used to display the HTML from EditLive!'s HTML document. --> <textarea id="documentContents" cols="80" rows="5">Pressing the Get HTML Contents button will extract the HTML from EditLive! and place the HTML into this textarea.</textarea> <!-- The button for copying the HTMl Document from EditLive! and displaying this HTML in the textarea --> <p><input type="button" value="Get HTML Contents" onclick="buttonPress()"></p> <!-- The instance of EditLive! --> <script language="JavaScript"> // Create a new EditLive! instance with the name "ELApplet", a height of 400 pixels and a width of 700 pixels. var editlive = new EditLiveJava("ELApplet", 700, 400); // This sets a relative or absolute path to the XML configuration file to use editlive.setConfigurationFile("../../redistributables/editlivejava/sample_eljconfig.xml"); // Before sending HTML to the instance of EditLive!, this HTML must be URL Encoded. // Javascript provides several URL Encoding methods, the best of which is // 'encodeURIComponent()' editlive.setDocument(encodeURIComponent("<html><head><title>Default Document Title</title></head><body><p>Original <i>HTML Document</i> loaded into EditLive!</p></body></html>")); // .show is the final call and instructs the JavaScript library (editlivejava.js) to insert a new EditLive! instance // at the this location. editlive.show(); /** Function extracts the contents of the EditLive! HTML Document * and displays this content in the textarea */ function buttonPress() { editlive.getDocument('getEditLiveDocument'); } function getEditLiveDocument(src) { document.exampleForm.documentContents.value = src; } </script> </form> </body> </html>
Overview
Content Tools
Activity