This page provides information on how to instantiate Ephox EditLive! for Java within a Web page using JavaScript code, and extract the HTML body from the applet. Its purpose is only to demonstrate how to extract the contents from EditLive! for Java. For more information about embedding EditLive! for Java in a Web page using JavaScript see the Basic JavaScript Example.
The following skills are required prior to working with this sample:
A simple HTML page with a text frame is initially loaded. A button is provided to launch EditLive! for Java in a new window. When submit is pressed on this page, the contents from EditLive! for Java are written back to the text frame on the initial HTML page.
This sample demonstrates how to perform the following with EditLive! for Java and JavaScript:
To embed EditLive! for Java within a Web page several steps are required. Each of these steps is explained here and code samples are provided. Please read and understand the Basic JavaScript Example first. This example merely builds on top of what you have learnt from the basic example. Two files will be needed; parent.html and newwinjssample.html.
First we will examine the HTML page, parent.html.
<script language="javascript">
<!--
// Opens a new window and launches EditLive! for Java
function openEditLiveforJava() {
var remote=null;
remote = window.open('newwinjssample.html','EditLive','width=' + 800 + ',height=' + 600 +',status=yes,resizable=yes,scrollbars=yes,location=yes,toolbar=yes');
} //openEditLiveJava
-->
</script>
<input type="button" value="Launch EditLive! for Java" onClick="openEditLiveforJava();">
<textarea name="elj_text" rows=30 cols=100></textarea>
<script language=javascript>
<!--
//Submits the content to the parent and closes the window
function submitToParent() {
var parentWindow = window.opener;
parentWindow.document.parentForm.elj_text.value = document.form1.ELJApplet1.value;
window.close();
return false;
} //submitToParent
-->
</script>
<form name="form1" onsubmit='return submitToParent();'>
<input type="submit" value="Submit">
EditLive! for Java may be simply opened and its contents extracted, as can be seen in this example.
Copyright © 2001-2004 Ephox Corporation. All Rights Reserved.