N
naveen
hai all
I am working in a project in whihc i need to modify the dom of a
webpage and reload the page with modified dom.
so for this i thought of working with JSObject and with applet
commnication
As a sample here is the code i am working i am getting the exception as
fallows
please help me out how to modify it
HTML part
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<applet id="myapplet" width="300" height="500" code ="jsobject.class"
codebase=".">
<param name="InitialMode" value="Normal">
</applet>
<script>
function f()
{
alert ("calling this frunction from java script via java ");
}
</script>
<BODY>
<input type="button" value ="from js to java"
onclick="document.myapplet.doitt()">
</BODY>
</HTML>
JAVA PART
import java.applet.*;
import netscape.javascript.*;
public class jsobject extends Applet {
private static final long serialVersionUID = 1L;
public void init()
{
JSObject win = JSObject.getWindow(this);
JSObject doc = (JSObject) win.getMember("document");
JSObject loc = (JSObject) doc.getMember("location");
String s = (String) loc.getMember("href"); //
document.location.href
win.call("f", null); ; }
}
Here is the exception
netscape.javascript.JSException
at netscape.javascript.JSObject.getWindow(JSObject.java:144)
at jsobject.init(jsobject.java:15)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have adedd the folder for netscape.javascript from jdk
So how can i modify this error
thanking you in advance
nimbooin
I am working in a project in whihc i need to modify the dom of a
webpage and reload the page with modified dom.
so for this i thought of working with JSObject and with applet
commnication
As a sample here is the code i am working i am getting the exception as
fallows
please help me out how to modify it
HTML part
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<applet id="myapplet" width="300" height="500" code ="jsobject.class"
codebase=".">
<param name="InitialMode" value="Normal">
</applet>
<script>
function f()
{
alert ("calling this frunction from java script via java ");
}
</script>
<BODY>
<input type="button" value ="from js to java"
onclick="document.myapplet.doitt()">
</BODY>
</HTML>
JAVA PART
import java.applet.*;
import netscape.javascript.*;
public class jsobject extends Applet {
private static final long serialVersionUID = 1L;
public void init()
{
JSObject win = JSObject.getWindow(this);
JSObject doc = (JSObject) win.getMember("document");
JSObject loc = (JSObject) doc.getMember("location");
String s = (String) loc.getMember("href"); //
document.location.href
win.call("f", null); ; }
}
Here is the exception
netscape.javascript.JSException
at netscape.javascript.JSObject.getWindow(JSObject.java:144)
at jsobject.init(jsobject.java:15)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have adedd the folder for netscape.javascript from jdk
So how can i modify this error
thanking you in advance
nimbooin