Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem calling javascript from an applet in NS 6

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to get my applet to call a Javascript function from within NS6. It works in IE. I am using the OBJECT/EMBED tags. (note: works also in Communicator with APPLET tag).
I am getting a JSObject exception upon my first call to JSObject.getWindow(this). I did discover if I put mayscript in uppercase, the above call would return "null" so I think I am getting farther.
I am also using dynamic class loading in my applet but I have tried both. I don't have a java40.jar file with the JS classes in them other than the one from Communicator 4.7. I have also tried using the java40.jar in my applet build with NS 6 without luck.
Here's my tags:
<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<!-- TAGS COMMENTED OUT FOR POSTING -->
<!--
<OBJECT classid="clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA"
WIDTH = "500" HEIGHT = "200" NAME = "CommandApplet" codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0">;
<PARAM NAME = CODE VALUE = "MyCommandApplet.class" >
<PARAM NAME = mayscript VALUE = true >
<PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.1">
<PARAM NAME="scriptable" VALUE="true">
<COMMENT>
<EMBED type="application/x-java-applet;jpi-version=1.3.1"
CODE = "MyCommandApplet.class"
NAME = "CommandApplet"
WIDTH = "500" HEIGHT = "200"
maystript=true
scriptable=true
pluginspage="http://java.sun.com/products/plugin/1.3.1/plugin-install.html">;
<NOEMBED>
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
-->
<!--"END_CONVERTED_APPLET"-->
Here's my applet snippet:
<!--
public void showDialog() {
// called from a button on the applet this is loaded.
System.out.println(">>> showDialog()");
try {
JSObject jsRoot = JSObject.getWindow(this); // throws exception in NS6
// ... MORE STUFF HERE
System.out.println("Success!");
}
catch(Exception ex){
System.out.println("Exception!");
}
System.out.println("<<< showDialog()");
}
-->
Thanks.
 
There's a way to do it better - find it. -Edison. A better tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic