Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
<!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" />
End Year

<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>

SQL
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) ----so on

and so on depending on the number of years i have entered in textbox star and end year.

JavaScript
<pre lang="Javascript">
Posted
Comments
Palash Mondal_ 13-Oct-15 10:21am    
Please format your question and post only the relevant part where you are having the issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900