我有一个JavaScript函数,我在这里发布并得到了一些答案。我需要更多帮助,以便我能够清楚地操作代码:
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);
}
我问过如何将JavaScript变量发送到JAVA applet,答案是将其添加到JavaScript中:
var myApp = document.applets['myApplet'];
myApp.receiveData(taxElem.innerHTML + subtotalElem.innerHTML);
建议我将此代码放在JAVA applet中
public void receiveData(String dataFromJS)
{
//Do what you need with your data
}
我了解了如何包含公共函数来从applet中检索数据,但是当我部署applet时,它不会检索数据 - 它是空的。