jPCT - a 3d engine for Java > Support

A javascript listening problem

(1/1)

Tornado7:
Hi, I hope this is my last problem….. After I’ve got the obj ID, I need to pass this value to a javascript that displays this value in the other side of my web page. So I’ve written the following code:

--- Code: ---

<html>
<head>
<title>ThreeDSim</title>
</head>
<body bgcolor="#000000" text="#FFFFFF" topmargin=0 rightmargin=0 leftmargin=0 marginheight=0 marginwidth=0>
<table>
<tr>
<td>&</td></tr>
<tr>
<td valign="middle" align="left">
<font size="5" face="arial">Road Accident Area</font><br>
<applet name="ThreeDSim"  code="ThreeDSimApplet" width="640" height="480"></applet>
<br>
</td></tr>
<tr>
<td>
 <script type="text/javascript">
    <!--
    var temp = document.applets[0].feritoID;
    document.writeln(temp);
   // -->
  </script>
</td>
</tr>
</table>
</body>
</html>


--- End code ---

and it works…. The problem is that the javascript obviously reads the feritoID value just when it’s loaded instead I need that the javascript reads this value whenever I make a click on the applet and so, this value changes. Exist a way to perform this task?

Bye and thanks

EgonOlsen:
I don't think so. At least i don't know of a way to make Javascript on a web page run when triggered from inside the applet. I suggest to use polling instead. Do something like


--- Code: ---
window.setInterval("pollApplet()",250);
.
.
.
funtion pollApplet() {
    var temp = document.applets[0].feritoID;
    // Do stuff with "temp" here  
}
--- End code ---


This will set temp to feritoID every 250ms.

Tornado7:
Ok, it works, thanks a lot  :D

Navigation

[0] Message Index

Go to full version