I?d like to use a applet HTML editor on my page. The one I found on www.hexidec.com/ekit.php works great and so I took it. Now I?d like to read/set the text to edit using JavaScript. The editor already has a function "getDocumentText()", which I call with an onClick-Event in my page:
For changing the text from outside the applet, I added a method "setDocumentText()":
public void setDocumentText(String newtext) { jptMain.setText(newtext); jptSource.setText(jptMain.getText()); }
On my page I have a textarea input and two buttons (set/get the text). The settext-button code is similiar to the above gettext example: <input type="button" name="settext" value="settext" onClick="document.Ekit.setDocumentText(document.myForm.HTML.value);">
This code behaves very seldom. Sometimes it works as I expect it to do, sometimes the browser hangs; I have to kill the java_vm processes then. When I show the java console in Mozilla, it seems as there is a endless loop generating events (ie calls to the function) - but where are those events coming from? I did only a single mouseclick! Same with Win2k/IE 5.x - sometimes it does, sometimes the browser dies...