# Thread: CS101 Introduction to Computing Assignment No 3 solution 31 December fall 2010

1. ## CS101 Introduction to Computing Assignment No 3 solution 31 December fall 2010

You are required to Design HTML layout, validate form fields and manage fields style with the help of JavaScript. (20 Marks)

Layout

2. Validate Empty Field

If user will submit form without entering any value in GPA. Display warning message.

Change field background color to pink.

On clicking ok reset layout to initial state (White background, pointer focus on GPA field).

3. Validate Alphabetic Value
If user will submit form with alphabetic value. Display warning message.

Change field background color to red.

On clicking ok reset layout to initial state (White background, pointer focus on GPA field).

4 Validate Range of Value

If user will submit form with value less than 1 and greater than 4. Display warning message.

Change field background color to light sky blue.

On clicking ok reset layout to initial state (White background, pointer focus on GPA field).

5. Validate Correct Numeric Value

If user will submit form with value > = 1 and < style="mso-bidi-font-weight:normal">Fair :: You got D grade”.

If user will submit form with value > = 2 and < style="mso-bidi-font-weight:normal">Good :: You got C grade”.

If user will submit form with value > = 3 and < style="mso-bidi-font-weight:normal">Very Good :: You got B grade ”.

If user will submit form with value equal to 4. Display message “Excellent :: You got A grade ”.

Change field background color to lime.

6. Validate Find Grades Button

If value is > = 1 and <= 4, on clicking ok jump to www. vu.edu.pk

For any other value or empty field must not jump to www. vu.edu.pk

Hints:

1. For pink color use keyword pink.

2. For red color use keyword red.

3. For light sky blue color use keyword lightskyblue.

4. For lime color use keyword lime.

5. To change field background color use backgroundColor property of style sheet in JavaScript.

6. To set pointer focus on GPA field use JavaScript function focus.
Solution will be uploaded soon

2. the cs101 assignment code is given below please make a folder cs101 then open notepad and save the code and save as it in to cs101 folder with the extention of .html
HTML Code:
```<html>
<title>Untitled Document</title>
<script type="text/javascript" language="javascript">
function check(numstr)
{
var a=document.getElementById('fid').value;
var regex1=/^[0-9-.]*\$/;
if(document.theform.grd.value.length<1)
{

document.theform.grd.style.backgroundColor="pink";
}
else if(regex1.test(a)==false)
{
document.theform.grd.style.backgroundColor="red";
fid.focus();
}
else if(document.theform.grd.value>4 || document.theform.grd.value<1)
{
document.theform.grd.style.backgroundColor="lightskyblue";
alert("Numeric Value Must be Between 0 and 4");
}
else if(document.theform.grd.value>=1 && document.theform.grd.value<2)
{
document.theform.grd.style.backgroundColor="lime";
}
else if(document.theform.grd.value>=2 && document.theform.grd.value<3)
{
document.theform.grd.style.backgroundColor="lime";
}
else if(document.theform.grd.value>=3 && document.theform.grd.value<4)
{
document.theform.grd.style.backgroundColor="lime";
alert("Very Good :: You got B grade");
}
else if(document.theform.grd.value=4)
{
document.theform.grd.style.backgroundColor="lime";
alert("Excellent :: You got A grade ");
}

}
</script>

<body bgcolor="#666666">
<h1 align="center">Your VU-ID Here:: Assignment (CS101)</h1>
<form name="theform">
<table border="1px" align="center" cellpadding="10px" cellspacing="1px">
<tr>
<td width="46">
CGPA </td>
<td width="199">
<input type="text" width="20px" name="grd" id="fid" />
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
<input type="button" value="Find Grade" onclick="check()"/>
</td>
</tr>
</table>
</form>
</body>
</html>```

its GPA not CGPA i geuss
and cant understand this thing
On clicking ok reset layout to initial state (White background, pointer focus on GPA field).

4. app code main kar kar cgpa ko gpa kar den. ab is ko change ker kay hi send kerna hai. so please don't send as it. other wise you will be in trouble

5. and why bout my other problem
On clicking ok reset layout to initial state (White background, pointer focus on GPA field).

6. means wht bout my other problem

7. i am busy right now i will solve it soon.

8. ## Most urgent

1. Plz tell us to reset at initial state of GPA at white background after clicking Ok.
2. Jump to website Virtual University of Pakistan after entering value between 1 & 4 when we click on ok

Plz do as soon as possible bcoz tomorrow is d last date of submission.

9. ok let see that what is the problem

10. ## Problem solved

The problem has been solved. I will submit it after due date.

Regards,

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft