I am going nuts with this. Perhaps I'm showing my increasing age? I'm
pretty good with C, JavaScript, AppleScript, etc, but after 20 years
of non-java programming I decided to spruce up a heavily javascripted
filemaker-based web site with some calls to some java functions I just
started writing.
the problem is, I can't get JavaScript to call my Java applet.
I was finally able to get it to work via Mozilla on windows XP, but no
other browser/platform combination will work.
Really, the combo's I need to support are Safari on the Mac, and
Explorer on the PC side
But neither of those work at all............
Here is the sample HTML and sample Java, it's about as simple as it
possibly could be..........
Being that all I want to do is call a Java function via JavaScript and
get a return value, I was hoping I could use the built-in VM of
whatever browser the user is using, but after spending the last 3 days
googling through the net and browsing every java book at the local
book store, I'm about ready to rip the hair out of my head.
This would seem to be a simple thing to want to do, but yet, it
doesn't seem to work except in Mozilla Win32
I tried a Sun HTML convertor that converted my applet tag to what was
suppose to be a cross platform object/embed tag, but that didn't work
either.
HTML Code
------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>Simple Applet Example</TITLE>
<SCRIPT>
function GetName()
{
var myApplet=document.getElementById("FMLinker")
alert(myApplet.name)
alert(myApplet.GetData())
}
</SCRIPT>
</HEAD>
<BODY>
<applet code="FMLinker.class" name="FMLinker" width=300 height=150
id="FMLinker" scriptable="true" mayscript="true">
Your browser does not support Java, so nothing is displayed.
</applet>
<form name="myForm" method="post" action="">
<input type="button" name="Button" value="Button" onClick="GetName()">
</form>
</BODY>
</HTML>
Java Code (i stripped out a bunch of code just to get to the simplest
case)
-----------------------------------------------------------------------
-----------------------------
import java.applet.*;
import java.net.*;
import java.awt.*;
import java.sql.*;
public class FMLinker extends Applet
{
public void init()
{
System.out.println("Hello, Java!");
System.out.println(GetData());
}
public String GetData()
{
String myResultString="haha";
return myResultString;
}
}
_______________________________________________
web-development mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/web-development
Do not post admin requests to the list. They will be ignored.