0% found this document useful (0 votes)
6 views5 pages

Javascript Program

The document contains multiple HTML pages with JavaScript functions for various tasks, including changing background colors, checking for palindromes, counting vowels, calculating average marks, and converting Fahrenheit to Celsius. Each section includes user input forms and buttons to trigger the respective JavaScript functions. The pages demonstrate basic interactivity and functionality using JavaScript in web development.

Uploaded by

anurajbadole
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)
6 views5 pages

Javascript Program

The document contains multiple HTML pages with JavaScript functions for various tasks, including changing background colors, checking for palindromes, counting vowels, calculating average marks, and converting Fahrenheit to Celsius. Each section includes user input forms and buttons to trigger the respective JavaScript functions. The pages demonstrate basic interactivity and functionality using JavaScript in web development.

Uploaded by

anurajbadole
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

<html>

<head><title></title>
<h1>background color changes automatically</h1>
<script language="JAVASCRIPT">
function f1()
{
[Link]('[Link]="blue"',1000);
[Link]('[Link]="pink"',1200);
[Link]('[Link]="green"',1400);
[Link]('[Link]="grey"',1600);
[Link]('[Link]="black"',1800);
[Link]('[Link]="yellow"',2000);
[Link]('[Link]="cyan"',2200);
}
function m()
{
[Link]="It is a magic!!";
}
</script>
<body >
<center>
<form name="frm">
<input type="button" value="colors" OnMouseOver="f1()">
<input type="button" value="msg" onClick="m()">
</form>
</body>
</html>
<html>
<body onLoad="f1()" onunLoad="m()">
<h1>background color changes automatically</h1>
<script language="JAVASCRIPT">
function f1()
{
[Link]('[Link]="blue"',1000);
[Link]('[Link]="pink"',1200);
[Link]('[Link]="green"',1400);
[Link]('[Link]="grey"',1600);
[Link]('[Link]="black"',1800);
[Link]('[Link]="yellow"',2000);
[Link]('[Link]="cyan"',2200);
}
function m()
{
alert("UnloadPage!!");
}
</script>
</body></html>
<!DOCTYPE html>
<html>
<head>
<title>
Palindrome program using javascript
</title>

<script language="javascript">
function test()
{
var a,str,n,i;
a=[Link];
str=[Link]();
n=[Link];
var p=1;
for(i=0; i<n/2;i++)
{
if([Link](i)!= [Link](n-1-i))
{
p=0;
break;
}
}
if(p==1)
alert("String is Palindrome");
else
alert("String is not a Palindrome");
}
</script></head>
<body bgcolor="pink"><center>
<h1>To accept string from user and reverse the given string and check whether it is
palindrome or not</h1>
<form name="frm">
Enter Your Name<input type="text" name="t1"><br><br>
<input type="button" name="b" value="Check string for Palindrome"
onClick="test()">
</form>
</body></center>
</html>
<!DOCTYPE html>
<html>
<head>
<title>
Count Vowels
</title>
<script type="text/javascript">
function test()
{
var str,i,ch,count;
count=0;
str=[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")
count++;
}
alert("Number of Vowels in string are "+count);
}
</script>
</head>
<body bgcolor="pink">
<center>
<h1>To accept string from user and count number of vowels</h1>
<form name="frm">
Enter string<input type="text" name="t1" required><br><br>
<input type="button" name="b" value="Counting of Vowels" onClick="test()">
</center>
</form>
</body>
</html>
<html>
<head><title></title>
<script language="javascript">
function test()
{
var a1,a2,a3,a4,a5,avg;
a1=parseInt([Link]);
a2=parseInt([Link]);
a3=parseInt([Link]);
a4=parseInt([Link]);
a5=parseInt([Link]);
avg=parseFloat((a1+a2+a3+a4+a5))/5;
alert("Average Marks of Student is "+avg);
if(avg>=91)
alert("Grade A");
else
{
if(avg>=81)
alert("Grade B");
else
{
if(avg>=71)
alert("Grade C");
else
{
if(avg>=61)
alert("Grade D");
else
alert("Grade F");
}
}
}
}
</script>
</head>
<body bgcolor="pink">
<center>
<form name="frm">
Enter Marks of IT::<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 Biology::<input type="number" name="t4"><br><br>
Enter Marks of Chemistry::<input type="number" name="t5"><br><br>
<input type="button" name="b" value="Result" onClick="test()"></center>
</form>
</body></html>
<html>
<head>
<script language="javascript">
function cel()
{
var c,f;
f=[Link];
c=(f-32)*(5/9);
[Link]=c;
}
</script>
</head>
<body>
<form name="frm">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="button" value="click" OnMouseOver="cel()">
</form>
</body>
</html>

You might also like