• 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

Communication Java-Javascript with plug-in

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am currently trying to communicate with applet and JavaScript
See my source code please and help me, I do't understand why it crash in IE with plig in Java 1.3.1
Many Thanks
x.
///////////////////
//HTML SOURCE
<html>
<HEAD>
<SCRIPT code="JavaScript">
function writeHtml(nbr){
document.writehtml.writeHtml(nbr);
};
</SCRIPT>
</HEAD>
<BODY>
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="300" height="300" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win.cab#Version=1,3,0,0"
name="writehtml">
<PARAM NAME=CODE VALUE=HtmlWriter>
<PARAM NAME="codebase" VALUE=".">
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="true">
<PARAM NAME="MAYSCRIPT" VALUE="true">
</OBJECT>
<FORM name="resto">
Nombre de lignes a g�n�rer : <input name="result" type="text" value="5"><BR>
<input type="button" onclick="javasript:writeHtml(document.resto.result.value)" value="OK">
</FORM>
</BODY>
</HTML>
//////////////////////
//JAVA JAPPLET SOURCE
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import netscape.javascript.*;
public class HtmlWriter extends JApplet{
JSObject win = null;
public void paint(Graphics g){
g.setColor(Color.black);
g.drawString("APPLET RUN...", 15,35);
}

public void writeHtml(String Nombre){
win.eval("alert('TEST2');"); // CRASH HERE!!!
}
public void init(){
win = JSObject.getWindow(this); //OK
win.eval("alert('TEST');"); //No PROBLEMES HERE
repaint();
}
}
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i don't know about using eval.. but this is how i call show an alert..
Object[] arguments = {"test"};
arguments[0] = "No Information retrieved from database.";
win.call("alert", arguments);
 
xavier gagneur
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Originally posted by Charlie Boss:
i don't know about using eval.. but this is how i call show an alert..
Object[] arguments = {"test"};
arguments[0] = "No Information retrieved from database.";
win.call("alert", arguments); // KRASH HERE

Hi Charlie,
That is the same problem when I use the win Object in applet
with the Java plug-in!
If i use the applet tag in HTML, that's OK but with the Object tag to use the plug-in it always crash IE.So I can't use JSObject
+win.call --> CRASH
+win.eval --> CRASH
+win.getMember(..) --> CRASH
But I don't know why it's work fine in the init methode.
If you can use JSObject with the plug-in help me please.
x.
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic