crazy4youbaby
10-18-2004, 02:44 PM
hey, how can i make a table that has rows according to what user inputs in the number of Process?? table should have 3 columns (No. of Process, Burst Time, Ariival Time)
for example, user input 5 as the number of process, he should enter burst time for each process as well as the arrival time. after that, when user click the button named "generate table", the output should be like a table having 5 rows, 3 columns.. displaying the process number with its corresponding burst time and arrival time..
please help.. urgent.. thanks in advance!!
here is my code.. just edit it.
<html>
<script= text/javascript>
// ENTER PROCESS NUMBER
function enterProc()
{
var mess='Minimum Number of Process: 2\nMaximum number of Process: 10';
alert(mess);
a=1;
while(a==1)
{
numProcess=prompt('Enter number of Process:','')
if (numProcess>=2 && numProcess<=10)
a=0;
else
alert("Error: " + '\n' + mess)
}
document.buttonForm.processBtn.disabled="disabled";
document.buttonForm.burstBtn.disabled="";
}
// ENTER BURST TIME
function enterBurst()
{
var burst = new Array()
for(var i=0;i<numProcess;i++)
{
burst[i]=prompt('PROCESS # '+(i+1)+'\nEnter Burst Time:','')
}
document.buttonForm.burstBtn.disabled="disabled";
document.buttonForm.arrivalBtn.disabled="";
}
// ENTER ARRIVAL TIME
function enterArrival(){
var arrival = new Array()
for(var i=0;i<numProcess;i++)
{
arrival[i]=prompt('PROCESS # '+(i+1)+'\nEnter Arrival Time:','')
}
document.buttonForm.arrivalBtn.disabled="disabled";
document.buttonForm.tableBtn.disabled="";
document.buttonForm.ganttBtn.disabled="";
document.buttonForm.cpuUtiBtn.disabled="";
document.buttonForm.truPutBtn.disabled="";
document.buttonForm.turnAroundBtn.disabled="";
document.buttonForm.w8timeBtn.disabled="";
}
// GENERATE TABLE
// THIS WILL BE THE FUNCTION TO BE CALLED
// AFTER CLICKING THE "GEN. TABLE" BUTTON..
</script>
<body>
<form name="buttonForm">
<input type="button" value="Enter Process Number" name="processBtn" onclick="enterProc()"><br>
<input type="button" value="Enter Burst Time" name="burstBtn" onclick="enterBurst()" disabled="disabled"><br>
<input type="button" value="Enter Arrival Time" name="arrivalBtn" onclick="enterArrival()" disabled="disabled"><br>
<input type="button" value="Generate Table" name="tableBtn" onclick="genTable()" disabled="disabled"><br>
</form>
</body>
</html>
for example, user input 5 as the number of process, he should enter burst time for each process as well as the arrival time. after that, when user click the button named "generate table", the output should be like a table having 5 rows, 3 columns.. displaying the process number with its corresponding burst time and arrival time..
please help.. urgent.. thanks in advance!!
here is my code.. just edit it.
<html>
<script= text/javascript>
// ENTER PROCESS NUMBER
function enterProc()
{
var mess='Minimum Number of Process: 2\nMaximum number of Process: 10';
alert(mess);
a=1;
while(a==1)
{
numProcess=prompt('Enter number of Process:','')
if (numProcess>=2 && numProcess<=10)
a=0;
else
alert("Error: " + '\n' + mess)
}
document.buttonForm.processBtn.disabled="disabled";
document.buttonForm.burstBtn.disabled="";
}
// ENTER BURST TIME
function enterBurst()
{
var burst = new Array()
for(var i=0;i<numProcess;i++)
{
burst[i]=prompt('PROCESS # '+(i+1)+'\nEnter Burst Time:','')
}
document.buttonForm.burstBtn.disabled="disabled";
document.buttonForm.arrivalBtn.disabled="";
}
// ENTER ARRIVAL TIME
function enterArrival(){
var arrival = new Array()
for(var i=0;i<numProcess;i++)
{
arrival[i]=prompt('PROCESS # '+(i+1)+'\nEnter Arrival Time:','')
}
document.buttonForm.arrivalBtn.disabled="disabled";
document.buttonForm.tableBtn.disabled="";
document.buttonForm.ganttBtn.disabled="";
document.buttonForm.cpuUtiBtn.disabled="";
document.buttonForm.truPutBtn.disabled="";
document.buttonForm.turnAroundBtn.disabled="";
document.buttonForm.w8timeBtn.disabled="";
}
// GENERATE TABLE
// THIS WILL BE THE FUNCTION TO BE CALLED
// AFTER CLICKING THE "GEN. TABLE" BUTTON..
</script>
<body>
<form name="buttonForm">
<input type="button" value="Enter Process Number" name="processBtn" onclick="enterProc()"><br>
<input type="button" value="Enter Burst Time" name="burstBtn" onclick="enterBurst()" disabled="disabled"><br>
<input type="button" value="Enter Arrival Time" name="arrivalBtn" onclick="enterArrival()" disabled="disabled"><br>
<input type="button" value="Generate Table" name="tableBtn" onclick="genTable()" disabled="disabled"><br>
</form>
</body>
</html>