aspose file tools*
The moose likes Applets and the fly likes JSObject, how can I call JS function from Java Applet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "JSObject, how can I call JS function from Java Applet ?" Watch "JSObject, how can I call JS function from Java Applet ?" New topic
Author

JSObject, how can I call JS function from Java Applet ?

AndXlr andrzej
Greenhorn

Joined: Oct 23, 2009
Posts: 2
Hi,
The code below working, but the calling JS not....and nothing happens , no error.
I did it with help from this side :
http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/java_js.html
Anybody know what is wrong?
Thanks!

HTML :


Java Applet

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41867
    
  63
Welcome to JavaRanch.

These are exclusively English-language forums; please supply an English translation of your question, or it is liable to be deleted.

What happens if you run this code? Are there any error messages, either from JavaScript or from Java?


Ping & DNS - my free Android networking tools app
AndXlr andrzej
Greenhorn

Joined: Oct 23, 2009
Posts: 2
Ulf Dittmer wrote:Welcome to JavaRanch.

These are exclusively English-language forums; please supply an English translation of your question, or it is liable to be deleted.

What happens if you run this code? Are there any error messages, either from JavaScript or from Java?


Hi Ulf ,
I am sorry, I mixed up languages

I don't get any Error, on my TextFeld I see massege from :

DIe beide Zahlen sind :12 12
So this code part is not working :
"
and after this nothing happens...

thank you!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41867
    
  63
Not sure what's going on, but LiveConnect (the Java/JavaScript bridge technology) is notoriously fickle. I'd recommend to use the Common DOM API instead, if at all possible.
Rok Štelcer
Ranch Hand

Joined: Nov 03, 2009
Posts: 101
Hi,

On the first look I'd say that there could be two potential problems in your example/code:

1. I'm not sure, if you're calling the JSObject.getWindow in a right place
As far as I know, you should call it in Applets init() method.
Example:

2. Following code is missing in your HTML:

Hope this helps.



Regards,
Rok


SCJP, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSObject, how can I call JS function from Java Applet ?