function calculate(){
var XString = document.BasicForm.inputX.value ; // String Input X
var YString = document.BasicForm.inputY.value ; // String Input Y
var ZString = document.BasicForm.inputZ.value ; // String Input Z
var MString = document.BasicForm.inputM.value ; // String Input M
var output ; // String Output var x = parseFloat( XString ); // Numeric Input X
var y = parseFloat( YString ); // Numeric Input Y
var z = parseFloat( ZString ); // Numeric Input Z
var m = parseFloat( MString ); // Numeric Input M
var subtotal;
var discount;
var finaltotal; subtotal = 15 * x + 10 * y + 30 * z + 1 * m ;
discount = subtotal * 0.2;
finaltotal = subtotal - discount; output = "Your subtotal is = " + subtotal ;
output = "the 20% discount =" +discount;
output = " the finaltotal is "+finaltotal;
document.BasicForm.results.value = output; return;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货