• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing Info Out of an Applet

 
Mark Mokris
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to pass out info, maybe just a numeric code, out of an applet to the calling web page so the code may be interrogated by Javascript?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah
sure there is. look(on google) for JSObject which is a netscape.javascript package part and u'd find it in java40.jar file...
u've to just get a window object in the applet code that will refer to the page that has the applet and then u can invoke methods written in that page's javascript and that way u can pass the code...
e.g. if u'd the object jsObject in ur applet and u want to invoke javascript method x() in the applet's html page then u've to do,
JSObject window = JSObject.getWindow( this );
window.call("x",new Object[]{"arg1", "arg2"});
probably u'd find getMemeber() and all other functions reference in examples u'd find but i found it not working appropriately instead this getting window object and just call a method worked better for me...
regards
maulin
 
Nicholas Turner
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its even easier
in jscript
var myValue = document.myApplet.getMyCode();
its that easy and the same for setters
just create properties in the applet
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!