This function obtains a count of the number of words present within the EditLive! for Java applet. It counts the number of words which lie between the <BODY> tags. This function takes the name of a JavaScript function as its only parameter.
JavaScript object.GetWordCount(jsFunct)
jsFunct Required. The name of the function which receives the word count obtained from the EditLive! for Java applet.
The following code first creates a JavaScript function which is to be used as the parameter for the GetWordCount function. The JavaScript function will display the word count of the EditLive! for Java applet in a JavaScript alert dialog. The GetWordCount 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>
<SCRIPT language="JavaScript">
<!--
function wordCountAlert(src){
alert('Word Count: '+src);
}
-->
</SCRIPT>
</HEAD>
<BODY>
<FORM name = exampleForm>
<!--Create an instance of EditLive! for Java-->
<H1>Instance of EditLive! for Java</H1>
<SCRIPT language="JavaScript">
<!--
var editlivejava1;
editlivejava1 = new EditLiveJava("eljava",600 , 400);
editlivejava1.setDownloadDirectory("editlivejava");
editlivejava1.setLocalDeployment(false);
editlivejava1.setXMLURL("sample_eljconfig.xml");
editlivejava1.setBody(escape('<p>There are 11 words in this instance of EditLive! for Java</p>'));
editlivejava1.show();
-->
</SCRIPT>
<BR>
<P>Click this button to obtain a word count</P>
<INPUT type="button" value="Word Count"
onClick="editlivejava1.GetWordCount('wordCountAlert');">
</FORM>
</BODY>
</HTML>
Copyright © 2001-2004 Ephox Corporation. All Rights Reserved.