0% found this document useful (0 votes)
3 views9 pages

Js Prog Code

The document contains three separate HTML scripts demonstrating different functionalities. The first script cycles through seven distinct background colors, the second calculates and displays a student's average grade based on input marks, and the third counts the number of vowels in a given name. Each script includes JavaScript functions to handle user interactions and display results.

Uploaded by

anurag6200633
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

Js Prog Code

The document contains three separate HTML scripts demonstrating different functionalities. The first script cycles through seven distinct background colors, the second calculates and displays a student's average grade based on input marks, and the third counts the number of vowels in a given name. Each script includes JavaScript functions to handle user interactions and display results.

Uploaded by

anurag6200633
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Sop1-color

<!doctype html>
<html>
<head>
<title>
Background colors
</title>
</head>
<body>
<center>
<h1 align="center">7 different and visibally distinct background colors</h1>
<form name="frm1">
</center>
<input type="button"name="btncolor"value="change color"onMouseOver="f2()">
<input type="button"name="btnmsg"value="message display"onClick="msg()">
<input type="button"name="btncolor"value="change color"onClick="f8()">
</form>
</body>
<script type="text/javascript">
do {
function f1()
{
[Link]="red";
[Link]("f2()",1500);
}
function f2()
{
[Link]="green";
[Link]("f3()",1500);
}
function f3()
{
[Link]="pink";
[Link]("f4()",1500);
}
function f4()
{
[Link]="orange";
[Link]("f5()",1500);
}
function f5()
{
[Link]="skyblue";
[Link]("f6()",1500);
}
function f6()
{
[Link]="voilet";
[Link]("f7()",1500);
}
function f7()
{
[Link]="aqua";
[Link]("f1()",1500);
}

}
while (onClick==f8());

function f8()
{
[Link]="white";
[Link]("f1()",1500);
}
function msg()
{
[Link]="Hello";
}
</script>
</html>
Js-color1
<!doctype html>
<html>
<head>
<title>
Background colors
</title>
</head>
<body Onload="f1()"onUnload="msg()">
<center>
<h1 aligen"center">7 different and visibally distinct background colors</h1>
</center>
</body>
<script type="text/javascript">
function f1()
{
[Link]="red";
[Link]("f2()",1500);
}
function f2()
{
[Link]="green";
[Link]("f3()",1500);
}
function f3()
{
[Link]="pink";
[Link]("f4()",1500);
}
function f4()
{
[Link]="orange";
[Link]("f5()",1500);
}
function f5()
{
[Link]="skyblue";
[Link]("f6()",1500);
}
function f6()
{
[Link]="voilet";
[Link]("f7()",1500);
}
function f7()
{
[Link]="aqua";
[Link]("f1()",1500);
}
function msg()
{
[Link]("Display of 7 different colors");
}
</script>
</head>
Sop2-grade
<html>
<body>
<form name="frm1">
Enter Marks Of English
<input type="number"name="t1"><br><br>
Enter Marks Of Maths
<input type="number"name="t2"><br><br>
Enter Marks Of Physics
<input type="number"name="t3"><br><br>
Enter Marks Of Chemistry
<input type="number"name="t4"><br><br>
Enter Marks Of IT
<input type="number"name="t5"><br><br>
<input type="button"name="btnclick"value="Print Grade"OnClick="grade()">
</form></body>
<script type="text/javascript">
function grade()
{
var m1,m2,m3,m4,m5,a;
m1=[Link];
m2=[Link];
m3=[Link];
m4=[Link];
m5=[Link];
a=(m1+m2+m3+m4+m5)/5;
alert("Average Marks Of Student is"+a);
if(a>=91)
alert("Grade A");
else
{
if(a>=81)
alert("Grade B");
else
{
if(a>=71)
alert("Grade C");
else
{
if(a>=61)
alert("Grade D");
else
alert("Grade F");
}}}}
</script>
<html>
Sop3-Vowels
<html>
<head>
<title>string function</title>
</head>
<body>
<form name="frm1">
Enter your name
<input type="text"name="t1"><br><br>
<input type="button"name="btncheck" value="count vowels" onClick="cnt()">
</form>
</body>
<script type="text/javascript">
function cnt()
{
var s,i,ch,c;
c=0;
s=[Link];
for(i=0;i<=[Link];i++)
{
ch=[Link](i);
if(ch=="A"||ch=="a"||ch=="E"||ch=="e"||ch=="I"||ch=="i"||ch=="O"||ch=="o"||
ch=="U"||ch=="u")
c++;
}
alert("Number of Vowels in string are"+c);
}
</script>
</html>

You might also like