<!DOCTYPE html>
<html>
<head>
<title>Generate Budget</title>
</head>
<scrip type="text/javascript">
function tableprint()
{
var numOfYears = Math.abs(document.getElementById('end').value - document.getElementById('start').value);
var budget = Math.abs(document.getElementById('budget').value);
var i = 0;
var tableHtml = "";
tableHtml = tableHtml.concat("
");
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("");
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("");
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("");
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("
| ");
tableHtml = tableHtml.concat(Number(document.getElementById('start').value)+Number(i));
tableHtml = tableHtml.concat(" |
Budget | ");
tableHtml = tableHtml.concat(budget/numOfYears);
tableHtml = tableHtml.concat(" |
Forecast | ");
tableHtml = tableHtml.concat(Number(document.getElementById('for'+i).value));
tableHtml = tableHtml.concat(" |
Actual | ");
tableHtml = tableHtml.concat(Number(document.getElementById('act'+i).value));
tableHtml = tableHtml.concat(" |
");
document.getElementById("textarea").innerHTML = tableHtml
}
function generateBudget()
{
var numOfYears = Math.abs(document.getElementById('end').value - document.getElementById('start').value);
var budget= Math.abs(document.getElementById('budget').value);
var i = 0;
if( numOfYears < 1)
{
numOfYears = 1;
}
var tableHtml = "";
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("");
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("");
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("");
tableHtml = tableHtml.concat("");
for (i=1; i<=numOfYears; i++)
{
tableHtml = tableHtml.concat("");
}
tableHtml = tableHtml.concat("
| ");
tableHtml = tableHtml.concat(Number(document.getElementById('start').value)+Number(i));
tableHtml = tableHtml.concat(" |
Budget | ");
tableHtml = tableHtml.concat(budget/numOfYears);
tableHtml = tableHtml.concat(" |
Forecast | ");
tableHtml = tableHtml.concat("<input type='text' name='for" +Number(i)+"' id='for" + Number(i) + "' />");
tableHtml = tableHtml.concat(" |
Actual | ");
tableHtml = tableHtml.concat("<input type='text' name='act" +Number(i)+"' id='act" + Number(i) + "' />");
tableHtml = tableHtml.concat(" |
");
tableHtml = tableHtml.concat("
<input type='button' name='submit' id='submit' value='Submit' />");
document.getElementById("form").innerHTML = tableHtml;
}
</script>
<body>
Start Year | <input type="text" name="start" id="start" />
| <input type="text" name="end" id="end" />
|
| | Budget | <input type="text" name="budget" id="budget"/>
<input type="button" name="generate" id="generate" value="Generate" /> |
|
</body>
<<</html>
this is the code .run it. after entering values in 3 text boxes the table is generated.. after that when i enter values in forecast and actual i click submit button and again table is generated. instead of this table i want textares to be displayed with the values in this format
2015:Budget(value);2015:Forecast (value);2015:actual(value);2016:Budget(value)
and so on depending on the number of years i have entered in textbox star and end year.
<pre lang="Javascript">