jQuery in Action, 2nd edition*
The moose likes Applets and the fly likes Unable to call applet methods from javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Unable to call applet methods from javascript" Watch "Unable to call applet methods from javascript" New topic
Author

Unable to call applet methods from javascript

rajesh anguraj
Greenhorn

Joined: Feb 06, 2008
Posts: 15
Hi all

I am trying to load an applet available inside a signed jar file from a html file. When i try to access the methods available in the applet,
i am facing errors like test() is not a function.

The applet code used is:

The javascript code is:


The applet code in html is :




Kindly tell me where should i place the applet class files and the signed jar file.

At present i have placed it inside the web-inf folder.

Kindly provide me a solution.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41180
    
  45
i am facing errors like test() is not a function.

That's probably because the applet does not have a method called "test".

var applet = document.getElementsByName('testApplet')[0];

What value does "applet" have at this point?

Kindly tell me where should i place the applet class files and the signed jar file. At present i have placed it inside the web-inf folder.

Nothing that's inside WEB-INF will be served to the client. Put it in the same directory as the HTML file containing the applet tag.


Ping & DNS - my free Android networking tools app
rajesh anguraj
Greenhorn

Joined: Feb 06, 2008
Posts: 15
There is a method test in my applet. Here in the code , by mistake i put the method name as Test, it is actually test()
rajesh anguraj
Greenhorn

Joined: Feb 06, 2008
Posts: 15
When i give alert message say alert(applet), i get it as object<AppletHTMLElement>.

I have placed the class files along with my html files.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to call applet methods from javascript
 
Similar Threads
Not able to access the javascript function defined in jspf from js
Is it a Netscape bug?
showModelessWindow() in IE restricts javascript to applet communication
Passing String[] from jsp to applet
how can use JTable in a JSP page