• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem calling javascript from an applet in NS 6

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic