1

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?
4
  • Please format the parts of your question that are code (and only those parts) as code. Please avoid phrases such as "you gave an answer", this is a community site with lots of people on it, not a one-to-one support service. Most of us haven't given you that answer. Commented Apr 12, 2012 at 13:40
  • why do you need an applet to display a receipt instead of just using javascript to do so? If your passing in arguments to the javascript function why are you using the DOM to get the values instead of using the arguments passed into the function? Commented Apr 12, 2012 at 13:53
  • There is an applet tag that I added to your last question. Please add it to this one so that I don't have to be running around, cleaning up after you. :( Commented Apr 12, 2012 at 14:02
  • i want to further connect the function to jni thats why i have included the printreceipt function.i want to connect to a FiscPrintDLL.dll file to print using Fiscal printer. Commented Apr 12, 2012 at 14:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.