Professional Documents
Culture Documents
Web Technologies Lab Manual-20MCA29 (1)
Web Technologies Lab Manual-20MCA29 (1)
Web Technologies Lab Manual-20MCA29 (1)
1. Create an XHTML page that provides information about your department. Your XHTML page
b. Horizontal rule
c. Meta element
d. Links
e. Images
f. Tables
Lab1a.xhtml
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head>
</head>
<body>
<p>
My Name is ABC,
Belagavi </p>
<br />
WELCOME
TO
VTU
</pre>
<br />
<p>
<pre>
x<sub>2</sub><sup>3</sup> + y<sub>1</sub><sup>2</sup>
</pre>
</p>
<br />
<p>
<pre>
if you get > 70%, then you will get " FCD "
if you get < 35%, then you are ' Fail '
</pre>
</p>
<br />
</body>
</html>
Lab1b.xhtml
<?xml version = "1.0" encoding = "utf-8"?>
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head>
</head>
<body>
found" />
<hr />
<tr>
</tr>
<tr align="center">
<th> Names</th>
</tr>
<tr>
<th>Suhasini</th>
<td align="left">Bandana</td>
<td align="center">Muttinahara</td>
<td align="right">Amruthavarshini</td>
</tr>
<tr>
<th rowspan="2"> <br /> Sudharani <br /> <br /> </th>
<td >Panchamaveda</td>
<td valign="top">Aragini</td>
<td
valign="bottom">rathasapthami</td>
</tr>
</table>
</body>
</html>
2. Develop and demonstrate the usage of inline, external and internal style sheet using CSS. Use
XHTML page that contains at least three paragraphs of text, listed elements and a table with four
rows and four columns
Lab2.xhtml
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head>
<style type="text/css">
p { font-size:28pt; color:green; }
.b { list-style-type: circle; }
#c { list-style-type: upper-alpha; }
#d { list-style-type: lower-alpha; }
#e { list-style-type: upper-roman; }
#f { list-style-type: lower-roman; }
table, th
{ border-left-style:dashed;
border-right-style:double;
border-top-style:dotted;
border-left-width:thick;
border-right-width:medium;
border-top-width:thin;
border-left-color:red;
border-right-color:green;
border-top-color:blue;
border-bottom-color:maroon;
p.two
{ padding-left:0.5in;
padding-top:0.2in;
padding-bottom: 0.1in;
margin:0.9in;
color:yellow;
</style>
</head>
<body>
</p>
<ul>
</ul>
<ol>
<li> C </li>
</ol>
<ol>
</ol>
<ol>
</ol>
<ol>
</ol>
<ol>
</ol>
<tr>
Mobile No </th>
</tr>
<tr>
</tr>
</table>
</body>
</html>
3. Develop and demonstrate a XHTML file that includes Javascript script for the following problems: a)
Input : A number n obtained using prompt Output : The first n Fibonacci numbers b) Input : A number
n obtained using prompt Output : A table of numbers from 1 to n and their squares using alert.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Fibonacci numbers </title>
</head>
<body bgcolor="yellow">
<font color="red">
<h1> FIBONACCI NUMBERS </h1>
<script type="text/Javascript">
var n, a=0,b=1,i,c
n=prompt ("enter a number", ' ')
if(n<=0) alert ("Invalid number")
else
{
if(n==1) document.write(a)
else document.write(a+ "<br/>" +b)
for(i=2;i<n;i++)
{
c=a+b
a=b
b=c
document.write("<br />" +c)
}
}
</script></font>
</body>
</html>
3a)OUTPUT:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Numbers and Squares</title>
</head>
<body>
<h1> printing the numbers and their squares... </h1>
<script type="text/javascript">
var n=prompt("enter n value:")
if(n>0)
{
msg="number and its squares:!:!:!:!:"
for(var i=1;i<=n;i++)
{
msg=msg+i+"--->"+i*i+"\n"
alert(msg)
}
}
else
alert("invalid")
</script>
</body>
</html>
3b)Output:
4.Develop, test and validate an XHTML document that has checkboxes for apple (59 cents each),
orange (49 cents each), and banana (39 cents each) along with submit button. Each check boxes
should have its own onclick event handler. These handlers must add the cost of their fruit to a total
cost. An event handler for the submit button must produce an alert window with the message ‘your
total cost is $xxx’, where xxx is the total cost of the chose fruit, including 5 percent sales tax. This
handler must return ‘false’ (to avoid actual submission of the form data). Modify the document to
accept quantity for each item using textboxes.
Lab4.xhtml
<html>
<head>
<script type="text/javascript">
var sum=0;
function add(n)
sum=sum+n;
function display()
sum=(0.05*sum+sum);
</script>
</head>
<body>
<form>
<label>Apple
</label>
</br></br>
<label>Orange
</label>
</br></br>
<label>Banana
</label>
</br>
</center>
</form>
</body>
</html>
5.a) Develop and demonstrate, using Javascript script, a XHTML document that collects the USN ( the
valid format is: A digit from 1 to 4 followed by two upper-case characters followed by two digits
followed by three upper-case characters followed by two digits; no embedded spaces allowed of the
user. Event handler must be included for the form element that collects this information to validate
the input. Messages in the alert windows must be produced when errors are detected.
b) Modify the above program to get the current semester also (restricted to be a number from 1 to 6).
Lab5a.html
var pattern1=/^[1-4][A-Z]{2}[0-9]{2}[A-Z]{3}[0-9]{3}$/
if((!usn.value.match(pattern1)) || usn.value.length==0)
{
alert("inavlid usn!\n enter valid usn")
return false
}
else
alert("usn valid")
}
</script>
<form action="">
<center>
<p>
usn: <input type="text" name="usn" /><br />
<input type="button" value="validate" onClick="fun(usn)" /><br />
</p>
</center>
</form>
</body>
</html>
5a.OUTPUT:
5b) Modify the above program to get the current semester also (restricted to be a number from 1 to 6)
5b.OUTPUT:
8.a)Develop and demonstrate, using JavaScript script, a XHTML document that contains three short
paragraphs of text, stacked on top of each other, with only enough of each showing so that the mouse
cursor can be placed over some part of them. When the cursor is placed over the exposed part of any
paragraph, it should rise to the top to become completely visible.
b)Modify the above document so that when a text is moved from the top stacking position, it returns
to its original position rather than to the bottom.
Lab8a.xhtml
"http://www.w3.org/TR/xhtml/DTD/xhtml1-transitional.dtd">
<html>
.div1
{ color:blue;
font-size:20pt;
background-color:yellow;
Z-index:1;
width:200;
position:absolute;
top:25px;
left:25px;
.div2
{ color:blue;
font-size:20pt;
background-color:green;
Z-index:2;
width:200;
position:absolute;
top:50px;
left:75px;
.div3
color:blue;
font-size:20pt;
background-color:white;
Z-index:3;
width:200;
position:absolute;
top:75px; left:100px;
</style>
</head>
<body bgcolor="gray">
<p> PARAGRAPH1
PARAGRAPH1
PARAGRAPH1
PARAGRAPH1
</p>
</div>
<p> PARAGRAPH2
PARAGRAPH2
PARAGRAPH2
PARAGRAPH2
</p>
</div>
<p>
PARAGRAPH3
PARAGRAPH3
PARAGRAPH3
PARAGRAPH3
</p> </div>
</body>
</html>
new3a.js:
var top='d3';
function sendtop(newtop)
dom[0]=document.getElementById('d1');
dom[1]=document.getElementById('d2');
dom[2]=document.getElementById('d3');
for(i=0;i<3;i++)
if( dom[i].id==newtop )
dom[i].style.zIndex="99";
else
top=parseInt(dom[i].style.zIndex);
top=top-1;
dom[i].style.zIndex=top.toString();
OUTPUT:
Lab8b.xhtml
Modify the above document so that when a text is moved from the top stacking position, it returns to
its original position rather than to the bottom.
<html>
<head>
<title>paragraphs</title>
<script type="text/javascript" src="new3b.js"></script>
<style type="text/css" >
.div1
{
color:blue;
font-size:20pt;
background-color:yellow;
Z-index:0;
width:200;
position:absolute;
top:25px;
left:25px;
}
.div2
{
color:blue;
font-size:20pt;
background-color:green;
Z-index:0;
width:250;
position:absolute;
top:50px;
left:75px;
}
.div3
{
color:blue;
font-size:20pt;
background-color:white;
Z-index:0;
width:300;
position:absolute;
top:75px; left:100px;
}
</style>
</head>
<body bgcolor="gray">
<div class="div1" id="d1" onmousedown= "sendtop('d1');">
<p>
PARAGRAPH1
PARAGRAPH1
PARAGRAPH1
PARAGRAPH1
</p>
</div>
PARAGRAPH2
PARAGRAPH2
PARAGRAPH2
PARAGRAPH2
</p>
</div>
PARAGRAPH3
PARAGRAPH3
PARAGRAPH3
PARAGRAPH3
</p>
</div>
</body>
</html>
New3b.js:
var top='d1';
function sendtop(newtop)
{
domtop=document.getElementById(top).style;
domnew=document.getElementById(newtop).style;
domtop.zIndex="0";
domnew.zIndex="25";
top=newtop;
}
OUTPUT:
Lab9.html
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function add()
var a = document.getElementById("t1").value;
var b = document.getElementById("t2").value;
c = +a + +b;
document.getElementById("t3").value = c;
function sub()
var a = document.getElementById("t1").value;
var b = document.getElementById("t2").value;
c = a - b;
document.getElementById("t3").value = c;
function mul()
var a = document.getElementById("t1").value;
var b = document.getElementById("t2").value;
c = a * b;
document.getElementById("t3").value = c;
function div()
var a = document.getElementById("t1").value;
var b = document.getElementById("t2").value;
c = a/b;
document.getElementById("t3").value = c;
</script>
</head>
<body>
<center>
<form>
</form>
</center>
</body>
</html>
OUTPUT:
10.Develop and demonstrate using jQuery to solve the following: a) Limit character input in the text
area including count. b) Based on check box, disable/enable the form submit button.
Lab10a.html
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.11.3.min.js"></script>
<meta charset="utf-8">
<style type="text/css">
textarea {
display:block;
margin:1em 0;
</style>
</head>
<body>
<form>
<label>Maximum 15 characters</label>
</form>
</body>
</html>
<script>
$('textarea').keyup(function() {
$('#rchars').text(textlen);
});
</script>
Lab10b.html
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.11.3.min.js"></script>
<meta charset="utf-8">
</head>
<body>
</body>
</html>
<script>
$('#accept').click(function() {
if ($('#submitbtn').is(':disabled')) {
$('#submitbtn').removeAttr('disabled');
} else {
$('#submitbtn').attr('disabled', 'disabled');
});</script>