0% found this document useful (0 votes)
73 views11 pages

IT SOP Javascript

11th state board javascript all sop

Uploaded by

dmpalwankar77
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)
73 views11 pages

IT SOP Javascript

11th state board javascript all sop

Uploaded by

dmpalwankar77
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/ 11

JAVASCRIPT

SOP 1A
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt functions
and control structures.

To accept integer and display the result by multiplying it with 3.

Program:
<html>
<head>
<title>Multiplying by 3</title>
</head>
<body bgcolor=skyblue>
<h1> Multiplication of an integer by 3</h1>
<script type="text/Javascript">
var a,b,c;
a=prompt("Enter any number");
b=parseInt(a);
c=3*b;
document.write("<h1>Your entered integer value is:- </h1>"+b);
document.write("<h1>Your result is:- </h1>"+c);
</script>
</body>
</html>
SOP 1B
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt functions
and control structures.
To accept two integers and display larger number of them.

Program:
<html>
<head>
<title>Larger of the two numbers</title>
</head>
<body bgcolor=skyblue>
<script type="text/Javascript">
var a,b,c,d;
a=prompt("Enter first number");
b=prompt("Enter second number");
c=parseInt(a);
d=parseInt(b);
document.write("<h1>The first integer entered is: </h1>"+c);
document.write("<h1>The second integer entered is: </h1>"+d);
if(c>d)
document.write("<h1>The larger value is: </h1>"+c);
else
document.write("<h1>The larger value is: </h1>"+d);
</script>
</body>
</html>
SOP 1C
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt functions
and control structures.
To check whether, user entered number is positive or negative.

Program:
<html>
<head>
<title>Check if the entered number is positive or not</title>
</head>
<body bgcolor=pink>
<script type="text/Javascript">
var a,b,c;
a=prompt("Enter any number");
b=parseInt(a);
if (b>0)
alert("Number is positive");
else
alert("Number is not positive");
</script>
</body>
</html>
SOP 2A
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt functions
and control structures.
To accept two positive or negative numbers and check whether they are equal or not.

Program:
<html>
<head>
<title>Square of a number</title>
</head>
<body bgcolor=black text=white>
<script type="text/Javascript">
var a,b;
a=prompt("Enter first number");
b=prompt("Enter second number");
if(a==b)
document.write("<h1>Numbers are equal</h1>");
else
document.write("<h1>Numbers are unequal</h1>");
</script>
</body>
</html>
SOP 2B
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt functions
and control structures.
To accept number and display square of it.

Program:
<html>
<head>
<title>Square of a number</title>
</head>
<body bgcolor=black text=white>
<script type="text/Javascript">
var a,b;
a=prompt("Enter any number");
b=a*a;
document.write("<h1>Your entered value is:- </h1>"+a);
document.write("<h1><mark>Square is:- </h1>"+b");
</script>
</body>
</html>
SOP 2C
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt functions
and control structures.
To check whether the accepted integer is multiple of 3 or multiple of 7.

Program:
<html>
<head>
<title>Check if the entered number is MULTIPLE of 3 or 7</title>
</head>
<body bgcolor=skyblue>
<script type="text/Javascript">

var a,b,c;
a=prompt("Enter any number");
document.write("Entered number is "+a);

if(a%3==0||a%7==0)
document.write("<h1>Entered number is multiple of 3 or 7");
else
document.write("<h1>Entered number is not a multiple of 3 or 7");

</script>
</body>
</html>
SOP 3A
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt string
functions and control structures.
To accept string and calculate its length.

Program:
<html>
<head>
<title>Word length</title>
</head>
<body bgcolor=pink>
<script type="text/Javascript">

var text1,text2;
text1=prompt("Enter any word");
document.write("<h1>Entered word is "+text1);
text2=text1.length;
document.write("<h1>Number of characters of entered word is "+text2);

</script>
</body>
</html>
SOP 3B
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt string
functions and control structures.
To accept string and display it into lowercase and uppercase.

Program:
<html>
<head>
<title>Display the text in Uppercase and Lowercase</title>
</head>
<body bgcolor=pink>
<script type="text/Javascript">

var text1,text2,text3;
text1=prompt("Enter any word");
document.write("<h1>Entered word is "+text1);
text2=text1.toUpperCase();
document.write("<h1>Upper case characters of entered word is "+text2);
text3=text1.toLowerCase();
document.write("<h1>Lower case characters of entered word is "+text3);

</script>
</body>
</html>
SOP 3C
Create JavaScript program for the following using appropriate variables, JavaScript inbuilt string
functions and control structures.
To check whether the length of string is 4 or greater.

Program:
<html>
<head>
<title>Check word length</title>
</head>
<body bgcolor=pink>
<script type="text/Javascript">
var a,b;
a=prompt("Enter any word ");
b=a.length;
document.write("<h1>Entered word is "+a);
document.write("<h1>String length of entered word is "+b);
if(b==4||b>4)
document.write("<h1>Entered word is having length greater than or equal to 4");
else
document.write("<h1>Entered word is having length less than 4");

</script>
</body>
</html>
SOP 4A
Create event driven JavaScript programs for the following using appropriate variables, JavaScript
inbuilt functions and control structures.

To accept number and validate if the given value is a number or not by clicking on the button.

Program:
<!DOCTYPE html>
<html>
<head>
<title> To accept number and validate if the given value is a number or not by clicking on the
button
</title>
<script language="javascript”>
function display()
{
var a;
a=f1.t1.value;
if(a>0)
alert(“Value is a number ”);
else
alert(“Value is a string ”);
}
</script>
</head>
<body>
<center>
<form name="f1">
Enter Value: <input type="text" name="t1"><br><br>
<input type="button" value=CHECK onClick="display()”>
</form>
</body>
</html>
SOP 4B
Create event driven JavaScript programs for the following using appropriate variables, JavaScript
inbuilt functions and control structures.

To calculate addition and division of two numbers.

Program:
<!DOCTYPE html>
<html>
<head>
<title>To calculate addition and division of two numbers.</title>
<script langauge=”Javascript”>
function add()
{
var a,b,result;
a=f1.t1.value;
b=f1.t2.value;
result=parseInt(a)+parseInt(b);
document.write("The Addition is ="+result);
}
function div()
{
var a,b,d;
a=f1.t1.value;
b=f1.t2.value;
d=parseInt(a)/parseInt(b);
document.write("The Divide is ="+d);
}
</script>
</head>
<body>
<form name="f1">
<center>
<H1>1st Number : <input type="text" name="t1"><br><br>
2nd Number : <input type="text" name="t2"><br><br></H1>
<input type="button" value="ADDITION" name="b1" onClick="add()">
<input type="button" value="DIVISION" name="b2" onClick="div()">
<input type="reset" value="RESET">
</form>
</body>
</html>

You might also like