A javascript listening problem

Started by Tornado7, May 20, 2004, 12:08:11 PM

Previous topic - Next topic

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:


<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>


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


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


This will set temp to feritoID every 250ms.

Tornado7