Hi, I'm learning JS, and I need help. Here is my code:
I truly appreciate the help, and realize this is probably the stupidest code you've all laid eyes on. I apologize, but one must start from SOMEWHERE.Code://This object is going to be used //so that at the end of the calcCost function, //the client can see the subtotal, tax, and grandtotal //in a portion of the webpage. Like a console, mayhaps. var dataWindow=new Object(); dataWindow.height=80; dataWindow.width=500; //This is the function that takes the subtotal, tax and grandtotal and simply displays them in //the data window. dataWindow.showResults=function(subtotal,tax,grandtotal){ return "Subtotal" + subtotal; return "Tax" + tax; return "Grandtotal" + grandtotal; } //This is the function that calculates the subtotal, tax and grandtotal. function calcCost(){ var itemCost=prompt("Enter the cost of the item here."); var subtotal=itemCost; document.write("Subtotal" + subtotal); var tax=.0825; document.write("Tax Charge" + tax); var grandtotal=(subtotal*tax); document.write("Grand Total" + grandtotal); dataWindow.showResults();//this call of the function should take the subtotal,tax and grandtotal //and display them in the dataWindow. }


Reply With Quote

Bookmarks