InsertHTMLAtCursor Function

Description

This function inserts developer specified HTML at the cursor within the EditLive! for Java applet.  This function takes a JavaScript string as its only parameter. 

Syntax

JavaScript object.InsertHTMLAtCursor(strHTML)

Parameters

strHTML Required.  The string containing the HTML to be inserted at the cursor within the EditLive! for Java applet. 
Note:  This string must be URL encoded.  This can be done done using the JavaScript escape function.

Example

The following code creates a <TEXTAREA>, named htmlToInsert, that will have its contents inserted into an instance of EditLive! for Java at the cursor position via the InsertHTMLAtCursor function.  The InsertHTMLAtCursor function will be associated with a HTML button.  The name of the EditLive! for Java applet is editlivejava1.

<HTML>
    <HEAD>
        <TITLE>EditLive! for Java JavaScript Example</TITLE>
        <!--Include the EditLive! for Java JavaScript Library-->
        <SCRIPT src="editlivejava/editlivejava.js" language="JavaScript"></SCRIPT>
    </HEAD>
    <BODY>
        <FORM name = exampleForm>
            <P>EditLive! for Java contents will be loaded from here</P>
            <!--Create a textarea to load the applet contents from-->
            <P>
            <TEXTAREA name="htmlToInsert" cols="40" rows="10"><p>Content to be inserted</p></TEXTAREA>    
            </P>
            <P>Click this button to insert HTML at the cursor in EditLive! for Java/P>
            <P>
            <INPUT type="button" name="button1" value="Insert HTML"
                 onClick="editlivejava1.InsertHTMLAtCursor(escape(document.exampleForm.htmlToInsert.value));" >
            </P>
            <!--Create an instance of EditLive! for Java-->
            <SCRIPT language="JavaScript">
            <!--
                var editlivejava1;
                editlivejava1 = new EditLiveJava("eljava",450 , 275);
                editlivejava1.setDownloadDirectory("editlivejava");
                editlivejava1.setLocalDeployment(false);
                editlivejava1.setXMLURL("sample_eljconfig.xml");
                editlivejava1.setBody(escape("<P>This is the EditLive! for Java Applet</P>"));
                editlivejava1.show();
            -->
            </SCRIPT>
        </FORM>
    </BODY>
</HTML>

See Also