title: JavaScript Communicating With Applet
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10124758/passing-data-between-javascript-and-a-java-applet">Passing data between javascript and a java applet</a>  </p>
  </blockquote>
  
  
  
  <p>I have this function in java applet</p>
  
  <pre><code>public void receiveData(String DatafromJS){}
  </code></pre>
  
  <p>and this function in JavaScript</p>
  
  <pre><code>function printreceipt(tax,subtotal,total)
  {
   subtotalElem=document.getElementById("total");
   taxElem=document.getElementById("tax");
  
   var myApp = document.applets['myApplet'];
   myApp.receiveData(taxElem.innerHTML + subtotalElem.innerHTML);
  }
  </code></pre>
  
  <p>I want to pass JavaScript variables, like tax inform of a string.  I wish to see the values of those variables in the applet.  Could someone help me with how to pass the data.  I want the applet to send that data to another class which is a <code>jni</code>, since I want to be printing this information using a fiscal printer.</p>