I need help with calling a java applet using the <applet> tag and reading the value being returned by one of the functions in the class...
here's my code:
<html>
<script>
function doThis()
{
alert (document.applets[0].getData())
var tmp = document.applets[0].getData()
alert (tmp)
// some other codes here...
}
</script>
<body>
<form>
<applet code="acode.class" archive="acode.jar" width=150 height=25></applet>
<input type="button" value="ok" onClick="doThis()">
</form>
</body>
</html>
my question is how come whenever i do an alert, it shows me the value of document.applets[0].getData() but when i try assigning it to a variable and do an alert on the variable, it comes out empty.
I need to assign it to another variable because i can't do this directly document.writeln ('<param name="sample" value="' + document.applets[0].getData() + '">'). The page will display an error message when it reaches this line so I tried assigning it to a variable "tmp" to do this line but i'm not getting the value. The getData() returns ascii %33%56%45%... as string, by the way.
Can anyone help me as to how to get this to work? Any help is greatly appreciated.
here's my code:
<html>
<script>
function doThis()
{
alert (document.applets[0].getData())
var tmp = document.applets[0].getData()
alert (tmp)
// some other codes here...
}
</script>
<body>
<form>
<applet code="acode.class" archive="acode.jar" width=150 height=25></applet>
<input type="button" value="ok" onClick="doThis()">
</form>
</body>
</html>
my question is how come whenever i do an alert, it shows me the value of document.applets[0].getData() but when i try assigning it to a variable and do an alert on the variable, it comes out empty.
I need to assign it to another variable because i can't do this directly document.writeln ('<param name="sample" value="' + document.applets[0].getData() + '">'). The page will display an error message when it reaches this line so I tried assigning it to a variable "tmp" to do this line but i'm not getting the value. The getData() returns ascii %33%56%45%... as string, by the way.
Can anyone help me as to how to get this to work? Any help is greatly appreciated.