Help! I cannot figure this out. I made the text boxes and etc, but calculating and displaying the results I am missing something. Please help.





Project 6B

table, tr, td {
text-align:center;
}
input[type=text] {
text-align:right;
}
.even {
background-color: #CCF;
}
.odd {
background-color: #036;
}
.header {
background-color:#000000;
color:#FFFFFF;
}


function computePeriods(){
// get the values from the users
var initWeight =
parseFloat(document.getElementById("initWeight").value);
var amtlost =
parseFloat(document.getElementById("amtlost").value);
var goalWeight =
parseFloat(document.getElementById("goalWeight").value);

// create a variable to keep track of the periods
var period = 1;
period++;

// create the table
var msg = "";
msg += "Period"
msg += "Amount";

while (initWeight >= goalWeight){
if (period % 2 == 0){
// even row
msg += "";
} else {
// odd row
msg += "";
}

msg += "" + period + "";
msg += ""+ initWeight + "";

// accumulate the amount and the periods
initWeight = amtlost;
period++;
}
msg += ""

document.getElementById("outputDiv").innerHTML = msg;
}






Initial Weight





Amount Lost in Pounds per period






Weight Goal