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

Object doesn't support this method or property-Error calling applets from javascript

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Im trying to call a method on the swing component from javascript. but the browser gives an javascript error dialog box as "Object doesn't support this method or property". pls help. iam attaching the code of both html and the applet.

applet
------

import javax.swing.JLabel;

public class TestApplet
extends javax.swing.JApplet
{

public void init()
{
this.getContentPane().add(new JLabel("Harsh"));
}

public void callMe()
{
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
public Object run() {
// do priv stuff here.
System.out.println("Applet Method called");
return null; // return whatever you want.
}
});
}
}



HTML
-----

<html>
<body onnload="callAppletMethod();">
<script>

function callAppletMethod()
{
alert("Inside function");
alert("document is"+document);
alert("document all is"+document.all);
alert("testApplet is"+document.TestApplet);
alert("testApplet callMe is"+document.TestApplet.callMe());
document.TestApplet.callMe();

}

</script>



<OBJECT

classid= "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"

codebase= "http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0";
WIDTH="775" HEIGHT="400" NAME="TestApplet">

<PARAM NAME = CODE VALUE = "TestApplet.class" >
<PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.4.1">
<PARAM NAME = "scriptable" VALUE = "true">
<PARAM NAME = "mayscript" VALUE="true">

<COMMENT>
<EMBED
type = "application/x-java-applet;jpi-version=1.4.1"
CODE = TestApplet
scriptable = false
pluginspage = "http://java.sun.com/products/plugin/index.html#download">;
<NOEMBED>
</TaskModel>'>
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>

</body>
</html>

Im using IE 6.0. the jdk version im using is 1.4.0
The strange thing is the same code works on some different machines. but im not able to trace what is the difference.

pls help

thanks in advance
chandru ram
Im using IE 6.0. the jdk version im using is 1.4.0
The strange thing is the same code works on some different machines. but im not able to trace what is the difference.

pls help

thanks in advance
chandru ram
Im using IE 6.0. the jdk version im using is 1.4.0
The strange thing is the same code works on some different machines. but im not able to trace what is the difference.

pls help

thanks in advance
chandru ram
    Bookmark Topic Watch Topic
  • New Topic