• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
chandru ram
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic