If the input is ='0', a prompt will appear and say "NO GRADE", If the input is ='20', a prompt will appear and say "Not Attending",If the input is ='30', a prompt will appear and say "Dropped", If the input is ='40', a prompt will appear and say "Incomplete",It will show what you've input and continue to input midterm grade. Same with the midterm and finals.
I got here my program for Prelim Grade but I got problem with the <=65 and >100. If I input 65, it will prompt and say INVALID ENTRY.After I input an Invalid Entry again, nothing will happen. After I input another invalid entry, a prompt will appear but after I input a valid entry, the valid entry won't show. It must be not stopping to prompt INVALID ENTRY and Request to input again until you Input a valid entry. After you input a valid entry, it will be shown on the browser.
we're asked to use do..while and while
<html>
<head>
<title>Web Programming Laboratory Exam</title>
</head>
<body>
<script language="Javascript">
do
{
{
var pg=prompt('Enter Prelim Grade','0');
if(pg==0)
{
alert('No Grade');
document.write('<br>Prelim Grade is '+pg);
}
else if(pg==20)
{
alert('Not Attending');
document.write('<br>Prelim Grade is '+pg);
}
else if(pg==30)
{
alert('Dropped');
document.write('<br>Prelim Grade is '+pg);
}
else if(pg==40)
{
alert('Incomplete');
document.write('<br>Prelim Grade is '+pg);
}
else if (pg<=65)
{
alert('Invalid Entry');
var pg=prompt('Enter Prelim Grade','0');
}
else if (pg>100)
{
alert('<br>Invalid Entry');
var pg=prompt('Enter Prelim Grade','0');
}
else
document.write('Prelim Grade is '+pg);
ppg=pg*.30
}
}
while (pg<=65)
{
}
</script>
</body>
</html>
I'm asking how my if..else on <=65 and >100 won't stop to ask me to input a valid entry and after I input a valid entry, the valid entry must be shown and continue to Midterm Grade.

New Topic/Question
Reply



MultiQuote





|