Beck FST WebDemo Festo

Back to index    Next    Previous

We can also use JavaScript to make dynamic graphics. For example it would be nice if the traffic light from the previous examples automatically changed if the Flagword value changed.
Click here to see an example with a dynamic traffic light, automatic refresh and 3 buttons to change the traffic light status.

This is the HTML code for the page:

   
<html>
  <head>
    <title>
      Dynamic traffic light
    </title>
    <meta http-equiv="Refresh" content="5;url=demo_09a.htm">
<script language="JavaScript" src="fst.js">
</script>
  </head>
  <body>
    This page will reload after 5 seconds.<br>
    Flagword 10=<FSTCI dmw10><br>
    Traffic light status is:
<script language="JavaScript">
<!-- ;
  // depending on the value of Flagword 10 we will insert different IMG tags into the HTML page
  switch ( <FSTCI dmw10> ) {
    case 0: document.write("<IMG src='trf_rd.gif'>"); break;
    case 1: document.write("<IMG src='trf_ye.gif'>"); break;
    case 2: document.write("<IMG src='trf_gr.gif'>"); break;
    default: document.write("?? Unknown"); break;
  }
// end hide -->
</script>
    <br>
    <form>
      <input type="button" value="Set Red" onclick="CISend('MW10', '0')">
      <input type="button" value="Set Yellow" onclick="CISend('MW10', '1')">
      <input type="button" value="Set Green" onclick="CISend('MW10', '2')">
    </form>
  </body>
</html>

Comments / remarks: i-sales@beck-ipc.com Last modified: 2000.05.10