Phil 0 Report post Posted August 1, 2004 I would like to make a webpage that allows the user to input various numbers into a series of testboxes and when they click calculate it will total the numbers for them and display it at the bottom in another textbox. Share this post Link to post Share on other sites
maximus_0217 0 Report post Posted August 1, 2004 So you want a sort of order form or just simply addition of numbers? Share this post Link to post Share on other sites
Phil 0 Report post Posted August 1, 2004 Well what i want is basically an order form where they also input the quantity and the price is already inputed. I am also confused what is the difference between Java and Javascript or is there a difference? Share this post Link to post Share on other sites
maximus_0217 0 Report post Posted August 1, 2004 One way to do it is to give make a quantity field and a disabled price field and give each an id:var userTotal;var i=0, ;while(document.getElementById){ var quantity = document.getElementById('quantity' + i).value; var price = document.geteElementById('price' + i).value; var total = quantity * price; userTotal += total; i++;}document.getElementById('totalPrice').value = userTotal;now your going to have issues with decimal places, but thats another story...though often confused, java and javascript are very different. javascript was created by netscape as a browser scripting language that lacks any file i/o,etc. Its simple and easy to learn, whereas java is a more substantial object oriented scripting language that can be used to create standalone applications and such Share this post Link to post Share on other sites
EricDrinkard 0 Report post Posted August 4, 2004 What does that do.Is it a calculator or what.Also can it be used on php site Share this post Link to post Share on other sites
Spectre 0 Report post Posted August 4, 2004 It's JavaScript. It can be inserted to any page that will be interpreted as HTML, and will work provided the client is capable for running JavaScripts. Share this post Link to post Share on other sites
Gamesquare 0 Report post Posted August 4, 2004 Javascript is easier and more convenient to use, but Java can be used for standalone applications and is overall much more powerful.As for the script you want, it would better to just do it serverside. If it's an order form and not just some sort of calculator, I assume it would involve serverside scripting anyway, so you might as well do the calculations serverside. Share this post Link to post Share on other sites