Professional Documents
Culture Documents
Web Lab (Ug)
Web Lab (Ug)
s.no
1.
2.
Forms
3.
4.
Layers
5.
6.
Developing in a table
7.
8.
Frames
Calculator
10
11
12
Mouse events
13
14
15
16
17
Moving Images
18
19
Exception Handling
20
1|Page
Page no
2|Page
3|Page
2. Forms
Sol
<html>
<head>
<title>forms</title>
</head>
<body bgcolor="pink">
<form>
first name
<input type="text"name="name"size="20"><br>
last name
<input type="text"name="name"size="20"><br>
email
<input type="text"name="name"size="20"><br>
password
<input type="password"name="name"size="20">
<br>
<age>
<input type="radio"name="age"value="yes">0-25
<input type="radio"name="age"value="yes">25-30
<input type="radio"name="age"value="yes">30-35
<input type="radio"name="age"value="yes">35-40
<input type="radio"name="age"value="yes">40+
<br>
<input type="submit"value="submit">
</form>
</body>
</html>
4|Page
5|Page
6|Page
7|Page
4.Layers
Sol;<html>
<head>
<title>Layers demo</title>
</head>
<body>
<div style="position:relative;
font-size:50px;
left:50;
top:10;
background-color:red;
z-index:1;">Hi</div>
<div style="position:relative;
font-size:50px;
left:150;
top:3;
background-color:green;
z-index:2;">Welcome to</div>
<div style="position:relative;
font-size:50px;
left:200;
top:-7;
background-color:blue;
z-index:3;">Drn College</div>
</body>
</html>
8|Page
9|Page
10 | P a g e
11 | P a g e
unordered list
Sol:<html>
<head>
<title>un order list</title></head>
<body><u><h1>un orderlist</h1></u>
<ul type="disc">
<li>mounika</li>
<li>pooja</li>
<li>laxmi</li>
</ul>
<ul type="circle">
<li>raju</li>
<li>pooja</li>
<li>laxmi</li>
</ul>
<ul type="square">
<li>mani</li>
<li>pooja</li>
<li>laxmi</li>
</ul>
</body>
</html>
12 | P a g e
13 | P a g e
6.Table Creation
<html>
<head>
<title>table</title>
</head>
<body><center><h1><u>table</u></h1>
<table
align="center"width="300"border="3"cellspacing="20"cellpading="10"bordercolor="
red">
<tr>
<td>mounika</td>
<td>laxmi</td>
<td>hema</td>
<td>kanchana</td>
</tr>
<tr>
<td>usha</td>
<td>maneesha</td>
<td>laxmi</td>
<td>yasoda</td>
</tr></table></body></html>
14 | P a g e
15 | P a g e
it is a paragraph
</p>
<h3>
it's blue
<a href="colorname.html">color</a>line
</h3>
</body>
</html>
17 | P a g e
18 | P a g e
8.Frames
<html>
<head>
<title>frames</title>
</head>
<frameset cols="150,*">
<frame src ="d:\bio data.html"name="left vertical">
<frameset rows="*,120">
<frame src="d:\frame1.html"name="right-top"
<frame src="d:\frame2.html"name="right-bottom"
</frameset>
</frameset>
</html>
19 | P a g e
20 | P a g e
9.Calculator
<html>
<body><title>calculator</title>
<center><h1><u><big>calculator
<form name=<"calculator">
<table border=4>
<tr><td>
<input type="text"name="input"size="10">
<br></td><tr>
<tr><td>
<body bgcolor="green">
<input type="button"name="one"value="1"Onclick="calc-value+='1'">
<input type="button"name="two"value="2"Onclick="calc-value+='2'">
<input type="button"name="three"value="3"Onclick="calc-value+='3'">
<input type="button"name="plus"value="+"Onclick="calc-value+='+'">
<br>
<input type="button"name="four"value="4"Onclick="calc-value+='4'">
<input type="button"name="five"value="5"Onclick="calc-value+='5'">
<input type="button"name="sixe"value="6"Onclick="calc-value+='6'">
<input type="button"name="x"value="*"Onclick="calc-value+='*'">
<br>
<input type="button"name="seven"value="7"Onclick="calc-value+='7'">
<input type="button"name="eight"value="8"Onclick="calc-value+='8'">
<input type="button"name="nine"value="9"Onclick="calc-value+='9'">
<input type="button"name="div"value="/"Onclick="calc-value+='/'">
<br>
<input type="button"name="%"value="%"Onclick="calc-value+='%'">
<input type="button"name="zero"value="0"Onclick="calc-value+='0'">
<input type="button"name="clear"value="c"Onclick="calc-value+=''">
<input type="button"name="doit"value="="Onclick="calc-value+='='">
</br>
</center>
</body>
</html>
21 | P a g e
22 | P a g e
23 | P a g e
24 | P a g e
25 | P a g e
26 | P a g e
27 | P a g e
28 | P a g e
29 | P a g e
30 | P a g e
Welcome page
<html>
<head><title>home page</title></head>
<body bgcolor=pink>
<center>
<img src="C:\Documents and Settings\All Users\Documents\My Pictures\Sample
Pictures\Sunset.jpg" width="200" height="150" align="left">
<h1>my book store</h1>
<tr>
<td><a href="d:\webpages\login.html"
target="right-frame">login</a></td>
<td><a href="d:\webpages\registration.html"
target="right-frame">
</frameset>
</frameset>
</html>
31 | P a g e
Course page
<html>
<body bgcolor=green>
<li><a href="d:\\webpages\\mpcs.html"target="right-frameset">mpcs</a></li>
<li><a href="d:\\webpages\\mpc.html"target="right-frameset">mpc</a></li>
<li><a href="d:\\webpages\\cbz.html"target="right-frameset">cbz</a></li>
<<li><a href="d:\\webpages\\ba.html"target="frameset">ba</a></li>
</body>
</html>
Display page
<html>
<body bgcolor="blue">
<h1>content</h1>
<img src="C:\Documents and Settings\All Users\Documents\My Pictures\Sample
Pictures\Winter.jpg" width=200 height=150 align="left">
<h3>
<p>this website is for displaying various courses of this college</p>
<p>the user of this site needs to login first</p>
</h3>
</body>
</html>
Login page
<html>
<body bgcolor=green><br><br><br>
<script language="javascript">
function validate()
{
if(document.form1.id.value="//document.form1.pwd.va
lue==" ")
{
alert("please fill up the information");
32 | P a g e
document.form1.id.focus();
}
}
</script>
<form name="form1">
<div align="center">
login:<input type=text name="id"><br>
password:<input type=password name="pwd">
<br><br/>
</div>
<br>
<br>
<div align="center">
<input type="submit"value="submit"on submit="validate()">
<input type="reset"value="reset">
</div>
</form>
</body>
</html>
33 | P a g e
homepage
Login page
34 | P a g e
35 | P a g e
36 | P a g e
16.TextMenu Creation
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Simple CSS Based Pulldowns</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
/* set the menu style */
.menuHead { font-weight: bold; font-size: larger; background-color: #A9A9A9;}
.menuChoices { background-color: #DCDCDC; width: 200px;}
.menu a {color: #000000; text-decoration: none;}
.menu a:hover {text-decoration: underline;}
/* position your menus */
#menu1 {position: absolute; top: 10px; left: 10px; width: 200px;}
#menu2 {position: absolute; top: 10px; left: 210px; width: 200px;}
#menu3 {position: absolute; top: 10px; left: 410px; width: 200px;}
</style>
<script type="text/javascript">
/* we'll only allow DOM browsers to simplify things*/
(document.getElementById ? DOMCapable = true : DOMCapable = false);
function hide(menuName)
{
if (DOMCapable)
{
var theMenu = document.getElementById(menuName+"choices");
theMenu.style.visibility = 'hidden';
}
}
function show(menuName)
{
if (DOMCapable)
{
var theMenu = document.getElementById(menuName+"choices");
theMenu.style.visibility = 'visible';
37 | P a g e
}
}
</script>
</head>
<body>
<div id="menu1" class="menu" onmouseover="show('menu1');"
onmouseout="hide('menu1');">
<div class="menuHead">Search Sites</div>
<div id="menu1choices" class="menuChoices">
<a href="/">Google</a><br />
<a href="/">Yahoo</a><br />
<a href="/">Teoma</a><br />
<a href="/">MSN</a><br />
<a href="/">DMOZ</a><br />
</div>
</div>
<div id="menu2" class="menu" onmouseover="show('menu2');"
onmouseout="hide('menu2');">
<div class="menuHead">E-commerce Sites</div>
<div id="menu2choices" class="menuChoices">
<a href="/">Amazon</a><br />
<a href="/">Ebay</a><br />
<a href="/">Buy.com</a><br />
</div>
</div>
<div id="menu3" class="menu" onmouseover="show('menu3');"
onmouseout="hide('menu3');">
<div class="menuHead">Book Releated Sites</div>
<div id="menu3choices" class="menuChoices">
<a href="/">JavaScriptRef</a><br />
<a href="/">W3C</a><br />
<a href="/">PINT</a><br />
</div>
</div>
<script type="text/javascript">
/* Don't hide menus for JS off and older browsers */
38 | P a g e
if (DOMCapable)
{
hide("menu1");
hide("menu2");
hide("menu3");
}
</script>
</body>
</html>
39 | P a g e
40 | P a g e
17.Moving images
<html>
<head>
<body>
<marquee behavior="scroll" direction="left" >Hi girls<img
src="D:\weblab2015\images10.Jpg" width="50" height="50" alt="no image"
/></marquee>
<marquee behavior="scroll" direction="left" >Hi girls<img
src="D:\weblab2015\images7.Jpg" width="150" height="150" alt="no image"
/></marquee>
<marquee behavior="slide" direction="right" scrollamount="10" >Hi girls<img
src="D:\weblab2015\images8.jpg" width="50" height="50" alt="no image"
/></marquee>
<marquee behavior="alternate" direction="down" >Hi girls<img
src="D:\weblab2015\images10.jpg" width="50" height="50" alt="no image"
/></marquee>
<marquee behavior="scroll" direction="right" >Hi girls<img
src="D:\weblab2015\images7.jpg" width="50" height="50" alt="no image"
/></marquee>
<marquee behavior="scroll" direction="up" >Hi girls<img
src="D:\weblab2015\images8.jpg" width="50" height="50" alt="no image"
/></marquee>
</body>
</html>
41 | P a g e
42 | P a g e
18.Regular Expression
<SCRIPT LANGUAGE="JavaScript"><!-function demoMatchClick() {
var re = new RegExp(document.demoMatch.regex.value);
if (document.demoMatch.subject.value.match(re)) {
alert("Successful match");
} else {
alert("No match");
}
}
function demoShowMatchClick() {
var re = new RegExp(document.demoMatch.regex.value);
var m = re.exec(document.demoMatch.subject.value);
if (m == null) {
alert("No match");
} else {
var s = "Match at position " + m.index + ":\n";
for (i = 0; i < m.length; i++) {
s = s + m[i] + "\n";
}
alert(s);
}
}
function demoReplaceClick() {
var re = new RegExp(document.demoMatch.regex.value, "g");
document.demoMatch.result.value =
document.demoMatch.subject.value.replace(re,
document.demoMatch.replacement.value);
}
// -->
</SCRIPT>
<FORM ID="demoMatch" NAME="demoMatch" METHOD=POST
ACTION="javascript:void(0)">
43 | P a g e
44 | P a g e
45 | P a g e
19.Expectional Handling
<html>
<head>
<script type="text/javascript">
function divide()
{
var a=100;
var b=0;
try
{
if(b==0)
{
throw("Divide by Zero Error");
}
else
{
var c;
c=a/b;
}
}
catch(e)
{
alert("Error :"+e);
}
finally
{
alert("i always Execute");
}
}
</script>
</head>
<body>
<p>click to see the result</p>
<form>
<input type="button" value="Click Me" onClick="divide();"/>
</form>
</body>
</html>
46 | P a g e
47 | P a g e
48 | P a g e