<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Requirments Document</title>
<script language=javascript>
var lastfield = 2;
var title = new Array();
title[1] = "Goal";
title[2] = "Functional";
function savefield(fn)
{
var fns = "D"+fn.toString();
alert(document.getElementById(fns).value);
}
function newfield()
{
var nexttitle = document.getElementById("newfield").value;
lastfield = lastfield + 1; var fid = lastfield.toString();
title[lastfield] = nexttitle;
var fid0 = lastfield + 1; var fid1 = fid0.toString();
document.getElementById(lastfield.toString()).innerHTML =
'<p>'+fid+". "+nexttitle+'</p><p><textarea rows="4" id="D'+fid+'" cols="60"></textarea> <input type=button value="Save" id="B'+fid+'" onclick="savefield('+lastfield+')"/></p><div id="'+fid1+'"></div>';
}
// go over all the fields and save their content
function showall()
{
for(var i=1 ; i <= lastfield ; i++) {
var fn = i.toString();
fns = "D"+fn; alert(title[i]+" "+document.getElementById(fns).value);
}
}
</script>
</head>
<body>
<input type=button value="show" id="B1" onclick="showall()"/>
<p>Requirements Specifications</p>
<p>1. Goal</p>
<p><textarea rows="4" id="D1" cols="60"></textarea>
<input type=button value="Save" id="B1" onclick="savefield(1)"/></p>
<p>2. Functional</p>
<p><textarea rows="4" id="D2" cols="60"></textarea>
<input type=button value="Save" id="B2" onclick="savefield(2)"/></p>
<div id="3">
</div>
<p><input type=text value="Subject Title" id="newfield" size="40"/>
<input type=button value="Add Field" id="B3" onclick="newfield()"/></p>
</body>
</html>