2009-07-24 10 views

Répondre

4

À partir de votre applet java

// object to allow applet to invoke Javascript methods 
protected static JSObject appletWindowJSObject = null; 

appletWindowJSObject = JSObject.getWindow(this); 

//Call your javascript method on the page and pass it something 
appletWindowJSObject.call("myJavascriptMethod", "This is what I am passing"); 

Vous pouvez ensuite utiliser javascript pour manipuler la page html comme d'habitude.

Peut également avoir besoin d'inclure le paramètre mayscript lors de la déclaration de l'applet, pas sûr si cela est nécessaire ou non.

0

+0

et comment cela pourrait-il être fait? –

+0

Il semble que: getAppletContext(). ShowDocument (nouvelle URL ("javascript: doSomething()")); pourrait être la réponse. Y a-t-il un autre moyen? –