PDA

View Full Version : Multiple (multiplications) In One Script/Alert?


asunderwood
01-05-2003, 06:03 AM
snip of current code begins

function doMath() {
var one = eval(document.theForm.elements[0].value)
var two = eval(document.theForm.elements[1].value)
var three = eval(document.theForm.elements[2].value)
var prod = one * two * three/100.00
alert("The total room tax is $" + prod )
}

snip of current code ends

Question? Can I somehow have the alert show an additional
line (comment) that is the result of just var one * var two? Current results (var one * var two * var three) works just fine but I'm wanting to expand the info included with the alert box.

Much appreciated,
Albert S. Underwood

whammy
01-05-2003, 06:52 AM
function doMath() {
var one = eval(document.theForm.elements[0].value)
var two = eval(document.theForm.elements[1].value)
var three = eval(document.theForm.elements[2].value)
var onetimestwo = one * two
var prod = one * two * three/100.00
alert("One times two: $" + onetimestwo + "\nThe total room tax is $" + prod )
}