Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
AndXlr andrzej
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
If you look closely at this tiny ad, you will see five bicycles and a naked woman:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic