HTML Programs:
1. Create a webpage to display address, city and comments using appropriate controls &
buttons.
Code:
<!DOCTYPE html>
<html>
<head>
<title>
Form
</title>
</head>
<body>
<form name=”f1”>
Address<textarea></textarea>
<br>
Select City:
<select>
<option>Mumbai</option>
<option>Thane</option>
<option>Navi Mumbai</option>
</select>
<br>
Comments<textarea></textarea>
<br>
<input type=”submit” name=”b1” value=”Submit”>
<input type=”reset” name=”b1” value=”Reset”>>
</form>
</body>
</html>
2. Create a webpage with a drop down list of cricketer Sachin, Dhoni ,Yuvraj, Virat & Rohit
and a submit & clear button with suitable heading and background colour.
Code:
<!DOCTYPE html>
<html>
<head>
<title>
Indian Cricket Team
</title>
</head>
<body bgcolor=”blue”>
<h1> Indian Cricket Team</h1>
<form name=”f1”>
Select Cricketer:
<select>
<option>Sachin</option>
<option>Dhoni</option>
<option>Yuvraj</option>
<option>Virat</option>
<option>Rohit</option>
</select>
<br>
<input type=”submit” name=”b1” value=”Submit”>
<input type=”reset” name=”b1” value=”Clear”>>
</form>
</body>
</html>
3. Create a web page to collect general information from a student using form which include
following: Name, address, city, pin code, gender and hobbies and submit button.
Code:
<!DOCTYPE html>
<html>
<head>
<title>
General Information
</title>
</head>
<body>
<form name=”f1”>
Name<input type=”text” name=”t1”>
<br>
Address<textarea></textarea>
<br>
Select City:
<select>
<option>Mumbai</option>
<option>Thane</option>
<option>Navi Mumbai</option>
</select>
<br>
Pincode<input type=”text” name=”t1”>
<br>
Gender
<input type=”radio” name=”r”>Male
<input type=”radio” name=”r”>Female
<br>
Hobbies:
<input type=”checkbox” name=”c1”>Dancing
<input type=”checkbox” name=”c2”>Singing
<input type=”checkbox” name=”c3”>Reading
<input type=”checkbox” name=”c4”>Drawing
<br>
<input type=”submit” name=”b1” value=”Submit”>
<input type=”reset” name=”b1” value=”Reset”>>
</form>
</body>
</html>
4. Write a program using HTML to design your class Time Table.
Code:
<!DOCTYPE html>
<html>
<head>
<title>
Class Time table
</title>
</head>
<body bgcolor="cyan" text="red">
<h1 align="center">Class TimeTable</h1>
<table border="2" bordercolor="purple" align="center">
<tr>
<th></th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
<tr>
<th>11.00 -11.40</th>
<td>Eng</td>
<td>IT</td>
<td>BK</td>
<td>OCM</td>
<td>ECO</td>
<td>Maths/SP</td>
</tr>
<tr>
<th>11.50 -12.30</th>
<td>IT</td>
<td>Maths/SP</td>
<td>Eng</td>
<td>BK</td>
<td>OCM</td>
<td>ECO</td>
</tr>
<tr>
<th>12.40 -1.20</th>
<td>BK</td>
<td>ECO</td>
<td>IT</td>
<td>Maths/SP</td>
<td>Eng</td>
<td>OCM</td>
</tr>
<tr>
<th>1.30 -2.10</th>
<td>OCM</td>
<td>BK</td>
<td>ECO</td>
<td>IT</td>
<td>Maths/SP</td>
<td>Eng</td>
</tr>
</table>
</body>
</html>
5. Write a html code for the following output:
Code:
<!DOCTYPE html>
<html>
<head>
<title>
Form
</title>
</head>
<body bgcolor="cyan" text="red">
<h1>Use of Form Elements</h1>
<form name="f1">
Enter Your Name:<input type="text">
<br>
Select your city:
<select>
<option>Pune</option>
<option>Mumbai</option>
<option>Thane</option>
<option>Navi Mumbai</option>
<option>Nashik</option>
<option>Nagpur</option>
</select>
<br>
Enter your Address:<textarea rows="5" cols="30"></textarea>
<br>
<input type="submit" value="send">
</form>
</body>
</html>
1. Write a JavaScript program to calculate & print 2. Write a JavaScript to calculate the area of the triangle.
addition, subtraction, multiplication & division of
two numbers.
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<script language=ʺjavascript"> <script language=ʺjavascript">
var a,b,res; var b,h,a;
a=parseInt(prompt(ʺEnter first numberʺ)); b=prompt(ʺEnter the base of the triangleʺ);
b=parseInt(prompt(ʺEnter second numberʺ)); h=prompt(ʺEnter the height of the triangleʺ);
res=a+b; a=1/2*b*h;
[Link](ʺ<br>Addition is:ʺ+res); [Link](ʺThe area of the triangle is:ʺ+a);
res=a-b; </script>
[Link](ʺ<br>Subtraction is:ʺ+res); </html>
res=a*b;
[Link](ʺ<br>Multiplication is:ʺ+res);
res=a/b;
[Link](ʺ<br>Division is:ʺ+res);
</script>
</html>
3. Write a JavaScript program to check whether the 4. Write a JavaScript to calculate the area of the triangle.
numbers is odd or even.
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<script language=ʺjavascript"> <script language=ʺjavascript">
var n; var n1,n2,n3,avg;
n=prompt(ʺEnter numberʺ); n1=prompt(ʺEnter first numberʺ);
if(n%2==0) n1=parseInt(n1);
[Link](ʺNumber is Evenʺ); n2=prompt(ʺEnter Second numberʺ);
else n2=parseInt(n2);
[Link](ʺNumber is Oddʺ); n3=prompt(ʺEnter third numberʺ);
</script> n3=parseInt(n3);
</html> avg=(n1+n2+n3)/3;
a=1/2*b*h;
[Link](ʺThe average of three numbers is:ʺ+avg);
</script>
</html>