Documente Academic
Documente Profesional
Documente Cultură
Samalkha, Panipat
08/02/2019
1. Create your own page with your favorite hobbies.
08/02/2019
2. Create a frameset that is divided into three
sections. The frameset should have three zones.
Create pages for each section. For the lowermost
section, create page that loads the content into the 08/02/2019
3. middle section. The topmost section should
contain a page describing the web page itself.
Ques: What is the syntax difference between a bulleted list and numbered list?
Ans: Bulleted lists use the <ul> tag, which stands for “unordered,” whereas <ol> is used to create
an ordered list.
Ques: What are some of the common lists that can be used when designing a page?
Ans: Some of the common lists that can be used are:
a) Ordered list
b) Unordered list
c) Definition list
d) Menu list
e) Directory list
Aim: Create a frameset that is divided into three sections. The frameset should have three zones.
• The Topmost section of the frameset should take up about just 15% of the
browser window. Name this frame title.
• The middle section should be 70% of the browser window. Name this frame title.
• The lower section should be 15% of the browser window. Name this frame menu.
Frame.html
<html>
<head>
<title>FRAMES</title>
</head>
<frameset rows="15%,75%,10%">
<frame name="frame1"src="a.html">
<frame name="frame2" src="b.html">
<frame name="frame3" src="c.html">
</frameset>
</frameset>
</html>
a.html
<html>
<head>
<title>FRAMES 1</title>
</head>
<body>
When you use frameset you split the visual real estate of a browser window into multiple frames. Each frame has it’s
own contents and the content in one don’t spill into the next.
An iframe, on the other hand, embeds a frame directly inline with the other elements of a webpage.
While both frames and iframes perform a similar function – embedding a resource into a webpage – they are
fundamentally different.
</body>
</html>
b.html
<html>
<head>
<title>FRAMES 2</title>
</head>
<body>
<strong>The History and Future of Frames</strong>
Frames have been deemed obsolete by the W3C in HTML5. The reasoning given for this is that frames create
usability and accessibility issues. Let’s consider each of these charges.
<br>
<br>
The Problem with Frames
<br>Usability challenges: With the rise in popularity of mobile devices and tablets with small displays it’s more
important than ever that websites offer multiple views which change based on the size of the device viewport. While
frames can be manipulated to provide a certain degree of responsiveness, they are simply not well-suited to creating
responsive websites.
<br><br> Accessibility challenges: Screen readers and other assistive technologies have a very hard time
understanding and communicating websites that use frames.
In addition to the accessibility and usability issues created by frames, the trend within web design is to separate the
content of a webpage from its presentation.
<br>
Content should be added and defined by markup such as HTML.
<br> Presentation should be manipulated with languages like CSS and JavaScript.
<br>Using frames is primarily about creating a specific look and layout, a presentation task that should really be
handled with CSS.
<br>
<br>To use frames on a page we use <frameset> tag instead of <body> tag. The <frameset> tag defines, how to
divide the window into frames. The rows attribute of <frameset> tag defines horizontal frames and cols attribute
defines vertical frames. Each frame is indicated by <frame> tag and it defines which HTML document shall open
into the frame.
<br> <br> Note − The <frame> tag deprecated in HTML5. Do not use this element.
</body>
</html>
c.html
<html>
<head>
<title>FRAMES 3</title>
</head>
<body>
<strong>The Future of Frames</strong>
While all modern browser offer support for frames today, the W3C has unequivocally stated that frames “are not to
be used by Web developers” and that support for frames in web browsers is offered for historical purposes only.
If you have a website that makes use of frames you should start planning a website migration away from frames. At
some point in the future support for frames will be dropped by modern web browsers, and when that happens
websites build with frames will become unusable.
</body>
OUTPUT :
PRACTICAL NO: 3
Aim: Create pages for each section. For the lowermost section, create page that loads the content
into the middle section. The topmost section should contain a page describing the web page
itself.
<HTML>
<HEAD><title>mypage</title>
</HEAD>
<FRAMESET ROWS="15%,70%,15%">
<FRAME NAME="a" SRC="PRAC5.1.html">
<FRAME NAME="b" SRC="PRAC5.2.html">
<FRAME NAME="c" SRC="PRAC5.3.html">
</FRAMESET>
</HTML>
PRAC5.1.html
<HTML>
<BODY>
<B><U>Brief Introduction Of the Page:</B></U><BR>This is a frameset that is divided into three sections. The
frameset should have three zones.<BR>
• The Topmost section of the frameset should take up about just 15% of the browser window and should contain a
page describing the web page itself.<BR>
• The middle section should be 70% of the browser window loads the content as requested from the third
section.<BR>
• The lower section should be 15% of the browser window that loads the content into the middle section.</BR>
</BODY>
</HTML>
PRAC5.2.html
<HTML>
<HEAD>
<STYLE>
a{
text-decoration: none;
color:black;
margin-right:30px;
margin-left:20px;
}
</STYLE>
</HEAD>
PRAC5.2.html
<BODY>
<H3><U>Table of Content</U><BR>
<A HREF="prac1.1.html" TARGET="b">PRACTICAL 1</A>
<A HREF="prac2.html" TARGET="b">PRACTICAL 2</A>
<A HREF="Prac3.html" TARGET="b">PRACTICAL 3</A>
<A HREF="Prac4.html" TARGET="b">PRACTICAL 4</A>
<A HREF="Prac5.html" TARGET="b">PRACTICAL 5</A>
</H3>
</BODY>
</HTML>
Products.html
<HTML>
<HEAD>
<TITLE>
WELCOME TO DAIRY
</TITLE>
<STYLE>
a{ text-decoration: none;
}
</STYLE>
</HEAD>
<BODY>
<H1><U> <CENTER>
WELCOME TO MY DAIRY
</H1> </CENTER><BR> <BR>
<CENTER><CAPTION ALIGN=CENTER><B>OUR DAIRY PRODUCTS </B>
</CAPTION></CENTER><BR><BR></U>
<CENTER><TABLE BORDER=5 WIDTH=50%>
<TR ALIGN=CENTER>
<TH>PRODUCT CODE
<TH>PRODUCT NAME
</TR>
<TR ALIGN=CENTER>
<TD>001
<TD> <A HREF="milk.html">MILK</A>
</TR>
<TR ALIGN=CENTER>
<TD>002
<TD> <A HREF="cheese.html">CHEESE</A>
</TR>
<TR ALIGN=CENTER>
<TD>003
<TD> <A HREF="butter.html">BUTTER</A>
</TR>
<TR ALIGN=CENTER>
<TD>004
<TD> <A HREF="ice_cream.html">ICE CREAM</A>
</TR>
<TR ALIGN=CENTER>
<TD>005
<TD> <A HREF="milk_shakes.html">MILK SHAKES</A>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Buymilk.html
<HTML>
<HEAD>
<TITLE>
WELCOME TO MY DAIRY
</TITLE>
</HEAD>
<BODY>
<H1><CENTER><U>
WELCOME TO MY DAIRY
</CENTER></H1>
<BR><BR>
<CENTER>
<CAPTION ALIGN=CENTER><B>MILK TYPES :</B></CAPTION></U><BR><BR>
<TABLE BORDER=5 WIDTH=50%>
<TR ALIGN=CENTER>
<TH>PRODUCT CODE
<TH>PRODUCT NAME
<TH>PRODUCT PRICE
<TH> BUY
</TR>
<TR ALIGN=CENTER>
<TD>MLK1
<TD>FULL CREAM MILK
<TD>Rs45 PER Kg
<td><A HREF="javascript.HTML">Buy</A>
</TR>
<TR ALIGN=CENTER>
<TD>MLK2
<TD>DOUBLE TONED MILK
<TD>Rs50 PER Kg
<td><A HREF="javascript.HTML">Buy</A>
</TR>
<TR ALIGN=CENTER>
<TD>MLK3
<TD>TONED MILK
<TD>Rs55 PER Kg
<td><A HREF="javascript.HTML">Buy</A>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Signin.html
<html>
<head>
</head>
<body>
<div>
<form name="RegForm" action="/submit.php" onsubmit="return formvalidation ()" method="post">
<h1>Sign In</h1>
<p>E-mail Address: <input type="text" size=65 name="EMail"> </p><br>
<p>Password: <input type="password" size=65 name="Password"> </p><br>
<p><input type="submit" value="Sign In" name="Submit"> <br><br>
</p>
</form>
</div>
</body>
</html>
Signup.html
<html>
<head>
</head>
<body>
<div>
<form name="RegForm" action="/submit.php" onsubmit="return formvalidation ()" method="post">
<h1>Registration Form</h1>
Aim: Create a web page, which displays the map of your country Link, each city /state on the
image map, such that the respective HTML page of the city/state is displayed when the
user selects an area.
<map name="image-map">
<area target="" alt="Jammu and Kashmir" title="Jammu and Kashmir" href="pages/jnk.html"
coords="378,375,345,133,458,50,843,157,913,201,802,446,642,368,534,451" shape="poly">
<area target="" alt="Himachal Pardesh" title="Himachal Pardesh" href="pages/hp.html"
coords="685,588,552,449,639,380,792,454" shape="poly">
<area target="" alt="Punjab" title="Punjab" href="pages/punjab.html"
coords="443,608,534,454,658,569,547,640" shape="poly">
<area target="" alt="Uttarakhand" title="Uttarakhand" href="pages/uk.html"
coords="701,606,769,496,948,617,852,733" shape="poly">
<area target="" alt="Haryana" title="Haryana" href="pages/haryana.html"
coords="496,631,589,781,683,797,690,730,693,597,653,578" shape="poly">
</map>
OUTPUT :
Short Questions:
Ques: What other ways can be used to align images and wrap text?
Tables can be used to position text and images. Another useful way to wrap text around an image
is to use style sheets.
import java.applet.*;
import java.awt.event.*;
import java.awt.Graphics.*;
import java.awt.*;
g.setColor(Color.black);
g.drawString("Timer:- "+ hrs + ":" + mins + ":" + secs, 10, 30);
//
int R = (int) (Math.random( )*237);
int G = (int)(Math.random( )*192);
int B= (int)(Math.random( )*171);
Color randomColor = new Color(R, G, B);
g.setFont(new Font("TimesRoman", Font.PLAIN,20));
g.setColor(randomColor);
g.drawString("Hello buddy"+(++count),10,70);
}
public void run()
{
while(true)
{
repaint();
try
{
clock.sleep(1000);
}
catch(InterruptedException e)
{
}
}
}
Ques: An applet can make network connections to any host on the Internet?
Ans: An applet can only connect to the host that it came from.
Ques: Which class enables applets to interact with JavaScript code in the applet's web
page?
Ans: The netscape.javascript.JSObject class enables applets to interact with JavaScript code in
the applet's web page.
Ques: Applets can modify the contents of the parent web page?
Ans: Applets can modify the contents of the parent web page by using the getDocument method
of the com.sun.java.browser.plugin2.DOMclass and the Common DOM API.
PRACTICAL NO: 6
Aim: Incorporate a quest book into the Diary Food Webpage and use Java Script to
build validations into the form.
Dairy.html
<HTML>
<HEAD>
<TITLE>
WELCOME TO DAIRY
</TITLE>
<STYLE>
a{ text-decoration: none;
color:black;
}
</STYLE></HEAD>
<BODY>
<H1><U> <CENTER>
WELCOME TO DAIRY
</H1><BR> <BR>
<CAPTION ALIGN=CENTER><B>WHITE ENERGY DAIRY PRODUCTS:</B>
</CAPTION><BR><BR></U>
<TABLE BORDER=5 WIDTH=50%>
<TR ALIGN=CENTER>
<TH>PRODUCT CODE
<TH>PRODUCT NAME
</TR>
<TR ALIGN=CENTER>
<TD>001
<TD> <A HREF="milkitems.html">MILK</A>
</TR>
<TR ALIGN=CENTER>
<TD>002
<TD> <A HREF="Prac1.3.HTML">CHEESE</A>
</TR>
<TR ALIGN=CENTER>
<TD>003
<TD> <A HREF="Prac1.4.HTML">BUTTER</A>
</TR>
</TABLE>
<P> For placing your order
<BR>
Contact : abc@whitenergy.com
</CENTER>
</BODY>
</HTML>
Milkitems.html
<HTML>
<HEAD>
<TITLE>
WELCOME TO MILK DAIRY
</TITLE>
</HEAD>
<BODY>
<H1><CENTER><U>
WELCOME TO MILK DAIRY
</CENTER></H1>
<BR><BR>
<CENTER>
<CAPTION ALIGN=CENTER><B>MILK TYPES :</B></CAPTION></U><BR><BR>
<TABLE BORDER=5 WIDTH=50%>
<TR ALIGN=CENTER>
<TH>PRODUCT CODE
<TH>PRODUCT NAME
<TH>PRODUCT PRICE
<TH> BUY
</TR>
<TR ALIGN=CENTER>
<TD>1001
<TD>TONED MILK
<TD>Rs 12 PER Kg
<td><A HREF="javascript.HTML">PURCHASE</A>
</TR>
<TR ALIGN=CENTER>
<TD>1002
<TD>DOUBLE TONED MILK
<TD>Rs 10 PER Kg
<td><A HREF="javascript.HTML">PURCHASE</A>
</TR>
<TR ALIGN=CENTER>
<TD>1003
<TD>FULL CREAM MILK
<TD>Rs 16 PER Kg
<td><A HREF="javascript.HTML">PURCHASE</A>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Web Engineering</TITLE>
<SCRIPT>
function validateForm() {
var x = document.myForm.fname.value;
var y=document.myForm.pass.value;
var len=y.length;
if (x == "" || y=="") {
alert("Fill in all details");
return false;
}
if(len<=4){
alert("Password Lenghth to be greater than 4");
return false;
}
var letters = /^[A-Za-z]+$/;
if(x.match(letters))
{
return true;
}
else
{
alert("Only Alphabets allowed in name");
return false;
}
}
</SCRIPT>
</HEAD>
<BODY>
<B><I>
<BR>
<BR>
<BR>
<FORM name="myForm" onsubmit="return validateForm()" method="post">
<PRE>
<H1><U>Login Page:</H1></U>
<H3>User Name    :<INPUT TYPE="text" name="fname">
<BR>Password & nbsp: <INPUT TYPE="password" name="pass">
</B></I><INPUT TYPE="submit" VALUE="ok"> <INPUT TYPE="reset" value="Reset"> <INPUT
TYPE="submit" VALUE="cancel">
</FORM>
</BODY>
</HTML>
OUTPUT :
Short answer Questions:
height: 24px;
border:4px solid black;
border-style:dashed;
text-align: center;
text-decoration: none;
}
#tw{
width: 810;
height: 30;
background-color :bisque;
color: brown;
border: 2px ridge blue;
text-align: center;
}
a{
text-decoration: none;
}
#b1{
width:800px;
height: 240px;
border:4px solid black;
border-style:ridge;
text-align: center;
position: absolute;
top :100 px;
left: 50px;
}
#b2{
width: 600;
height: 200;
background-color :bisque;
color: brown;
border: 2px ridge blue;
text-align: center;
position: relative;
left: 95px;
top:19px;
}
</STYLE>
</HEAD>
<BODY>
<DIV id="first">
<A href="SignUp_page.html">SignUp Page</a>
</DIV>
<BR>
<DIV id="tw">
My data
</DIV>
<BR><BR>
<DIV id="b1">
<DIV id="b2">
My second data
</DIV>
</DIV>
</BODY>
</HTML>
<html>
<head>
<title>Web Engineering</title>
</head>
<body>
<b><i>
<br>
<br>
<pre>
<form><font size="5">
<form><font size="5">Name: <input type="text">Roll No: <input type="text">
Gender: <input type="RADIO" name="gender">Male <input type="RADIO" name="gender">Female
Contact Number: <input type="text">Semester: <select >
<option value="1">1st</option>
<option value="2">2nd</option>
<option value="3">3rd</option>
<option value="4">4rth</option>
<option value="5">5th</option>
<option>6th</option>
<option>7th</option>
<option>8th</option></select>Fav. Subject:<input type="checkbox" name="a">we <input type="checkbox"
name="a">se <input type="checkbox" name="a">nothing </p>Comments : <textarea rows="5"
cols="22"></textarea> <input type="submit" value="ok"> <input type="reset"
value="Reset"> <input type="submit" value="cancel">
</b></i> <a href="prac9.html">Go to the previous page....</a></pre></font>
</body>
</html>
OUTPUT :
Short answer Questions:
JAVASCRIPT LOOPS
HTML FILE
<html>
<head>
<title>Loops in Javascript</title>
<link rel="stylesheet" type="text/css" href="loops.css">
<script>
var x
function loop()
{
var a="";
var i;
for(i=1;i<=5;i++)
{
a += "The number is " + i + "<br>";
}
document.getElementById("demo").innerHTML = a;
}
</script>
<style>
#demo
{
background-color: lightpink;
}
.button
{
background-color: black;
font-size: 14px;
cursor: pointer;
padding: 10px;
text-align: center;
color:aliceblue;
}
.button1
{
border-radius: 2px;
}
</style>
</head>
<body bgcolor="#cbc7c5">
<br>
<div id="l1" align="center">
<CENTER><BR>
<font face="ALLGERIAN" size="30" color="whitesmoke">LOOPS IN
JAVASCRIPT!</font>
</CENTER>
</div><br>
<table align="center">
<tr>
<td>
<div id="l2" align="center"><br>
<div id="l3" align="left"></div>
<br>
<div id="l4" align="left"><br>
<center>
<font face="stencil" size="15" color="black">FOR LOOP</font>
</center>
</div>
<div id="l3" align="left"></div>
<br>
</div>
</td>
<td></td> <td></td>
<td>
<div id="l2" align="center">
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l4" align="left"><br>
<center>
<font face="stencil" size="10" color="black">DO WHILE LOOP</font>
</center>
</div>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br>
<div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div>
<br><div id="l3" align="left"></div></div>
</td>
<td></td> <td></td> </tr>
</table>
</body>
</html>
CSS FILE
#l1
{
background-color: crimson;
height: 100px;
width: 1500px;
border-radius: 30px;
}
#l2
{
background-color: white;
height: 600px;
width: 350px;
border-radius: 30px;
}
#l3
{
background-color: powderblue;
height: 1px;
width: 350px;
border-radius: 30px;
}
#l4
{
background-color: yellow;
height: 130px;
width: 350px;
}
#l5
{
background-color: greenyellow;
height: 30px;
width: 350px;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Outputs are printed to console
<script type="text/javascript">
function add(op1, op2) {
if (op2 == 0) {
console.log("adding two zero would return in zero as well");
return;
}
return op1+op2;
}
// Pass by value
op1 = 10;
op2 = 20;
console.log(add(op1, op2));
// -----------------------------------------------------------------------------
function addByReference(op) {
// If you modify op object here, global op object will be modified as well
// e.g. op.op2 = 3000 will also change the value of op.op2 outside this
function
if (op.op2 == 0) {
console.log("cannot divide by zero");
return;
}
return op.op1+op.op2;
}
// Pass by Reference
op = {
"op1": 10,
"op2": 20
}
console.log(addByReference(op));
// -----------------------------------------------------------------------------
function modifyObj(o) {
o.hey = "modified value";
}
// references themselves as value
obj = {
"hey": "there"
}
obj2 = obj;
modifyObj(obj2);
console.log(obj.hey);
// -----------------------------------------------------------------------------
</script>
</body>
</html>
OUTPUT:
PRACTICAL NO: 10
AIM: Write program in Java Script for pattern matching using regular expressions and errors in
scripts.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Javascript Pattern Matching</title>
<style>
body {
font-family: Helvetica;
}
input {
padding: 5px 10px;
font-size: 1em;
}
</style>
</head>
<body>
<label>Pattern</label>
<input id="pattern" type="text" value="[0-9]{10}">
<label>Sample</label>
<input id="sample" type="text" value="">
<button onclick = "testPattern()" name="button">Test Expression</button>
<p><b id="result"></b></p>
<script type="text/javascript">
function testPattern() {
var pattern = document.getElementById("pattern").value;
var sample = document.getElementById("sample").value;
var pattern = new RegExp(pattern, "g");
if(pattern.test(sample)) {
document.getElementById("result").innerHTML = "Pattern Matched!!";
} else {
document.getElementById("result").innerHTML = "Pattern does not
Match!!";
}
}
</script>
</body></html>
OUTPUT:
PRACTICAL NO: 11
AIM: Write a Python function/program that accepts the lengths of three sides of a triangle as
inputs. The program output should indicate whether or not the triangle is an equilateral triangle.
AIM: Write the Python functions for linear search, binary search, selection sort, Bubble Sort,
Insertion Sort and converting Fibonacci to a linear algorithm.
CODE:
elements = [4, 2, 8, 9, 3, 7]
print("\nElements we have\n")
print(elements)
print("\n")
def linearSearch():
x = int(input("Enter number for linear search: "))
found = False
for i in range(len(elements)):
if(elements[i] == x):
found = True
print("%d found at position %d"%(x,i+1))
break
if(found == False):
print("%d is not in list"%x)
def binarySearch(elements):
item = int(input("Enter number for binary search: "))
first = 0
last = len(elements)-1
found = False
elements.sort()
print("\nSorted Elements are\n")
print(elements)
print("\n")
while first<=last and not found:
midpoint = (first + last)//2
if elements[midpoint] == item:
found = True
else:
if item < elements[midpoint]:
last = midpoint-1
else:
first = midpoint+1
if not found:
print("Element not found")
else:
print("Element Found at position %d"%(midpoint))
return found
def selectionSort(nlist):
for i in range(len(nlist)):
min_idx = i
for j in range(i+1, len(nlist)):
if nlist[min_idx] > nlist[j]:
min_idx = j
nlist[i], nlist[min_idx] = nlist[min_idx], nlist[i]
print("Sorted list is : ")
print(nlist)
def bubbleSort(nlist):
for passnum in range(len(nlist)-1,0,-1):
for i in range(passnum):
if nlist[i]>nlist[i+1]:
temp = nlist[i]
nlist[i] = nlist[i+1]
nlist[i+1] = temp
print("Sorted list is : ")
print(nlist)
def insertionSort(nlist):
for index in range(1,len(nlist)):
currentvalue = nlist[index]
position = index
while position>0 and nlist[position-1]>currentvalue:
nlist[position]=nlist[position-1]
position = position-1
nlist[position]=currentvalue
print("Sorted list is : ")
print(nlist)
def GenerateFibonaci(nterms):
n1 = 0
n2 = 1
count = 0
while count < nterms:
print(n1)
nth = n1 + n2
# update values
n1 = n2
n2 = nth
count += 1
choice = int(input("Enter your choice: \n Enter 1 for Linear Search. \n Enter 2 For Binary Search.
\n Enter 3 For Selection Sort. \n Enter 4 For Bubble Sort \n Enter 5 for Insertion Sort\n Enter 6
For Converting Fibonacci to linear.\n Enter 0 to stop.\n"))
if choice == 1 : linearSearch()
elif choice == 2 : binarySearch(elements)
elif choice == 3 : selectionSort(elements)
elif choice == 4 : bubbleSort(elements)
elif choice == 5 : insertionSort(elements)
elif choice == 6 :
print("\n\n")
print("Fibonacci Series is : ")
GenerateFibonaci(10)
else:
print("Invalid Option")
OUTPUT: