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

Javascript SOP For Printout

The document contains multiple Standard Operating Procedures (SOPs) that include JavaScript functionalities for various applications such as changing background colors, validating telephone numbers and email addresses, converting Celsius to Fahrenheit, and calculating average marks with grading. Each SOP is structured with HTML forms and JavaScript functions to handle user input and display results. The document demonstrates basic web development techniques using HTML and JavaScript.

Uploaded by

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

Javascript SOP For Printout

The document contains multiple Standard Operating Procedures (SOPs) that include JavaScript functionalities for various applications such as changing background colors, validating telephone numbers and email addresses, converting Celsius to Fahrenheit, and calculating average marks with grading. Each SOP is structured with HTML forms and JavaScript functions to handle user input and display results. The document demonstrates basic web development techniques using HTML and JavaScript.

Uploaded by

rkoanimo49
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SOP 1 Colors window.

setTimeout("f1()",3000);
<!DOCTYPE html> }
<html> function msg()
<head> {
<title> window.status="Display of 7 different colors";
Background Colors }
</title> </script>
</head> </html>
<body>
<h1 align="center">7 Different & visibly distinct
background colors</h1>
<form name="frm1">
<center>
<input type="button" name="btncolor"
value="Change Colors" onMouseOver="f1()">
<input type="button" name="btnmsg"
value="Message Display" onClick="msg()">
</form>
</body>
<script type="text/javascript">
function f1()
{
document.bgColor="red";
window.setTimeout("f2()",3000);
}
function f2()
{
document.bgColor="green";
window.setTimeout("f3()",3000);
}
function f3()
{
document.bgColor="pink";
window.setTimeout("f4()",3000);
}
function f4()
{
document.bgColor="orange";
window.setTimeout("f5()",3000);
}
function f5()
{
document.bgColor="skyblue";
window.setTimeout("f6()",3000);
}
function f6()
{
document.bgColor="voilet";
window.setTimeout("f7()",1500);
}
function f7()
{
document.bgColor="aqua";
SOP 2 Telephone validation
<html>
<body>
<form name="frm1">
Enter Name
<input type="text" name="t1"><br><br>
Enter Address<br>
<textarea name="t2"
placeholder="PERMENANT
ADDRESS"></textarea><br><br>
Enter Telehpone Number
<input type="tel"
maxlength="10"><br><br>
Enter Email Address
<input type="email" name="t3"
pattern="[A-Z a-z]{5}-[@]{1}-[.]{1}"
placeholder="[email protected]">
<br><br>
<input type="button" name="b1"
value="Submit" onClick="chk()">
</form>
</body>
<script type="text/javascript">
function chk()
{
var x=frm1.t3.value;
var atpos=x.indexOf("@");
var lastat=x.lastIndexOf("@");
var firstdot=x.indexOf(".");
var dotpos =x.lastIndexOf(".");
if(atpos<1||dotpos<atpos+2||dotpos+2>=x
.length||firstdot<atpos||atpos<lastat)
{
alert("Not a valid email address");
frm1.t3.focus();
}
else
{
alert("Email address is accepted");
return true;
}
}
</script>
</html>
SOP 3 Celsius
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Celcius to
Fahrenhet</h2>
<p>Insert a number into one of the
input fields below:</p>
<p><input type="text" id="c"
onkeyup="convert('C')"> Degrees
Celsius</p>
<p><input type="text" id="f"
onkeyup="convert('F')"> degrees
Fahrenheit</p>
<p>Note that the
<b>Math.round()</b> method is
used, so that the result will be
returned as an integer.</p>
<script type=”text/javascript”>
function convert(degree)
{
var x;
if (degree == "C")
{
x=
document.getElementById("c").val
ue * 9 / 5 + 32;

document.getElementById("f").val
ue = Math.round(x);
}
else
{
x=
(document.getElementById("f").val
ue -32) * 5 / 9;

document.getElementById("c").val
ue = Math.round(x);
}
}
</script>
</body>
</html>
SOP 4 Average marks "+a);
<!DOCTYPE html>
if(a>=91)
<html>
alert("Grade A");
<body>
else
<form name="frm1">
{
Enter Marks of English
if(a>=81)
<input type="number"
name="t1"><br><br> alert("Grade B");

Enter Marks of Maths else

<input type="number" {
name="t2"><br><br> if(a>=71)
Enter Marks of Physics alert("Grade C");
<input type="number" else
name="t3"><br><br>
{
Enter Marks of Chemistry
if(a>=61)
<input type="number"
name="t4"><br><br> alert("Grade D");

Enter Marks of IT else

<input type="number" alert("Grade F");


name="t5"><br><br>
} }} }
<input type="button"
</script>
name="btnclick" value="Print
Grade" onClick="grade()"> <html>
</form> Output:-
</body>
<script type="text/javascript">
function grade()
{
var m1,m2,m3,m4,m5,a;
m1=frm1.t1.value;
m2=frm1.t2.value;
m3=frm1.t3.value;
m4=frm1.t4.value;
m5=frm1.t5.value;
a=(m1+m2+m3+m4+m5)/5;
alert("Average Marks of Student is

You might also like