0% found this document useful (0 votes)
79 views

XI I.T HTML and Javascript Practical Document

Uploaded by

mitgediya4.sphs
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

XI I.T HTML and Javascript Practical Document

Uploaded by

mitgediya4.sphs
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

HTML

SOP 1
<!doctype html>
<html>
<head>
<title>Personal Details</title>
</head>
<body bgcolor=green text=red>
<h1>My First Web Page</h1>
<hr>
Name:<b>Amit Patel</b><br>
Address:<i>203 Raj Tower, Kandivali(West)</i><br>
Standard:11<sup>th</sup>
</body>
</html>

1
SOP 2
<!doctype html>
<html>
<head>
<title>Scientist</title>
</head>
<body bgcolor=skyblue text=blue>
<img src=einstein.jpg alt=Einstein>
<p>Einstein is best known for developing the theory of relativity, but he also made
important contributions to the development of the theory of quantum mechanics.</P>
<table border=2>
<tr>
<th>Sr.No.</th>
<th>Invensions</th>
</tr>
<tr>
<td>1</td>
<td>Quantum Theory of Light</td>
</tr>
<tr>
<td>2</td>
<td>Theory of Relativity</td>
</tr>
</table>
</body>
</html>

2
SOP 3
<!doctype html>
<html>
<head>
<title>form</title>
</head>
<body bgcolor=skyblue text=blue>
<h1 align=center>Application Form</h1>
<form name=f1>
Enter Name:<input type=text name=t1><br>
Standard:<br>
<input type=radio name=r1 value=1>11<sup>th</sup><br>
<input type=radio name=r1 value=2>12<sup>th</sup><br>
<input type=submit name=submit value=submit>
</form>
</body>
</html>

3
SOP 4
<!doctype html>
<html>
<head>
<title>Strength</title>
</head>
<body bgcolor=skyblue text=blue>
<table border=2>
<tr>
<th>Number of Students</th>
<th>Boys</th>
<th>Girls</th>
</tr>
<tr align=center>
<td>100</td>
<td>50</td>
<td>50</td>
</tr>
</table>
<a href="demo.html">Click Here</a>
</body>
</html>

Demo.html
<!doctype html>
<html>
<head>
<title>Details</title>
</head>
<body bgcolor=skyblue text=blue>
<b>STD-XI</b><br>
<i>Stream-Science</i><br>
<u>Div-A</u>
</body>
</html>

4
JAVASCRIPT
SOP 1
To accept integer and display the result by multiplying it with 3.
<!doctype html>
<html>
<head>
<title> Multiply</title>
</head>
<body>
<script language=javascript>
n=parseInt(prompt("Enter a number"))
document.write(n + "*" + 3 + " is " + n*3)
</script>
</body>
</html>
Input
Enter number 20

Output

To accept two integers and display larger number of them


<!doctype html>
<html>
<head>
<title>Greater</title>
</head>
<body>
<script language=javascript>
n1=parseInt(prompt("Enter a number"))
n2=parseInt(prompt("Enter another number"))
if(n1>n2)
document.write(n1+" is greater")
else
document.write(n2+" is greater")
</script>
</body>
</html>
Input
Enter a number 20
Enter another number 30

Output

5
To check whether, user entered number is positive or negative
<!doctype html>
<html>
<head>
<title>Positive negative</title>
</head>
<body>
<script language=javascript>
n=parseInt(prompt("Enter a number"))
if(n>0)
document.write(n+" is positive")
else
document.write(n+" is negative")
</script>
</body>
</html>
Input
Enter a number -87

Output

Sop2
To accept two positive or negative numbers and check whether they are equal or not.
<!doctype html>
<html>
<head>
<title>Equal or not equal</title>
</head>
<body>
<script language=javascript>
n1=parseInt(prompt("Enter a number"))
n2=parseInt(prompt("Enter another number"))
if(n1==n2)
document.write(n1 + " and " + n2 + " are equal")
else
document.write(n1 + " and " + n2 + " are not equal")
</script>
</body>
</html>
Input
Enter a number 50
Enter another number 60
Output

6
To accept number and display square of it.
<!doctype html>
<html>
<head>
<title>Square</title>
</head>
<body>
<script language=javascript>
n1=parseInt(prompt("Enter a number"))
document.write("<br>The square of " + n1 + " is " + n1*n1 + "<br>")
</script>
</body>
</html>
Input
Enter a number 25

Output

To check whether the accepted integer is multiple of 3 or multiple of 7


<!doctype html>
<html>
<head>
<title>Multiple of 3 or 7</title>
</head>
<body>
<script language=javascript>
n=parseInt(prompt("Enter a number"))
if((n%3==0)||(n%7==0))
document.write(n+" is a multiple of 3 or 7")
else
document.write(n+" is not a multiple of 3 or 7")
</script>
</body>
</html>
Input
Enter a number 42
Output

7
Sop3
To accept string and calculate its length
<!doctype html>
<html>
<head>
<title>Length of the string</title>
</head>
<body>
<script language=javascript>
s=prompt("Enter a string")
document.write("The length of the string is "+s.length)
</script>
</body>
</html>
Input
Enter a string:welcome
Output

To accept string and display it into lowercase and uppercase.


<!doctype html>
<html>
<head>
<title>Upper and Lowercase</title>
</head>
<body>
<script language=javascript>
s=prompt("Enter a string")
document.write("<br>The string in lower case is "+s.toLowerCase())
document.write("<br>The string in upper case is "+s.toUpperCase())
</script>
</body>
</html>
Input
Enter a string:welcome

Output

8
To check whether the length of string is 4 or greater.
<!doctype html>
<html>
<head>
<title>Length of the string 4 or greater</title>
</head>
<body>
<script language=javascript>
s=prompt("Enter a string")
if(s.length>=4)
document.write("<br> The length of the string is 4 or greater")
else
document.write("<br>The length of the string is less than 4")
</script>
</body>
</html>
Input
Enter a string:welcome

Output

Sop4
To accept number and validate if the given value is a number or not by clicking on the
button
<!doctype html>
<html>
<head>
<title>Check Number or not</title>
</head>
<body bgcolor=skyblue text=blue>
<h1 align=center>Number or not</h1>
<form name=f>
Enter a Number:<input type=text name=t><br>
<input type=button name=b1 value=Check onclick=s()>
<script language=javascript>
function s()
{
n=f.t.value
if(isNaN(n))
document.write(n+" is Not a number")
else
document.write(n+" is a Number")
}
</script>
</form>

9
</body>
</html>

Input
Enter a string:asdf

Output

To calculate addition and division of two numbers.


<!doctype html>
<html>
<head>
<title>Addition & Division</title>
</head>
<body bgcolor=skyblue text=blue>
<form name=f>
1<sup>st</sup> Number:<input type=text name=t1><br>
2<sup>nd</sup> Number:<input type=text name=t2><br>
<input type=button name=b1 value=Addition onclick=s1()>
<input type=button name=b2 value=Divide onclick=s2()>
<script language=javascript>
function s1()
{
n1=parseInt(f.t1.value)
n2=parseInt(f.t2.value)
document.write("The sum of " + n1 + " and " + n2 + " is " +(n1+n2))
}
function s2()
{
n1=parseInt(f.t1.value)
n2=parseInt(f.t2.value)
document.write("The quotient of " + n1 + " / " + n2 + " is " + (n1/n2))
}
</script>
</form>
</body>
</html>

10
Input

Output

11

You might also like