I have a JavaScript function which I had posted here and got some answers. I need more help so that I can be in a position to manipulate code clearly:
function printreceipt(tax,subtotal,total)
{
subtotalElem=document.getElementById("total");
var taxElem=document.getElementById("tax");
productElem=document.getElementById("product-name");
alert("here are my products" + taxElem.innerHTML + subtotalElem.innerHTML);
}
I asked how to send JavaScript variables to JAVA applet and the answer was to add this to the JavaScript:
var myApp = document.applets['myApplet'];
myApp.receiveData(taxElem.innerHTML + subtotalElem.innerHTML);
It was recommended I put this code in the JAVA applet
public void receiveData(String dataFromJS)
{
//Do what you need with your data
}
I was shown how to include the public function to retrieve data from the applet, but when I deploy the applet, it does not retrieve the data - it is empty.
- How can I get the data in the form of a string, like the contents in tax.
- How can I add arguments in the code to retrieve contents of the elements like tax.
- How do I display the data in the applet?