XI I.T HTML and Javascript Practical Document
XI I.T HTML and Javascript Practical Document
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
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
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
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
10
Input
Output
11