AWP-LAB-MANUAL-
AWP-LAB-MANUAL-
WEB PROGRAMMING
SUBECT CODE: 8 IT 7
INDEX
Web Programming Lab: 8 IT 7
S. No Contents
1 Lab Objective
2 Guidelines to Students
5 VIVA QUESTIONS
Web Programming Lab: 8 IT 7
Graduates will able to know about the HTML, CSS, VB Script, Java Script, Apache Web
Server, Internet Information Server, Active X Controls, JSP, ASP, Java Servlets, PHP, Ajax
Programming, Web Services
Web Programming Lab: 8 IT 7
Guidelines to Students
Equipment in the lab for the use of student community. Students need to maintain a
proper decorum in the computer lab. Students must use the equipment with care. Any
damage is caused is punishable.
Students are required to carry their observation / programs book with completed
exercises while entering the lab.
Students are supposed to occupy the machines allotted to them and are not supposed
to talk or make noise in the lab. The allocation is put up on the lab notice board.
Lab can be used in free time / lunch hours by the students who need to use the
systems should take prior permission from the lab in-charge.
Lab records need to be submitted on or before date of submission.
Students are not supposed to use floppy disks
Use of computer network is encouraged.
Web Programming Lab: 8 IT 7
The purpose of jQuery is to make it much easier to use JavaScript on your website.
jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish,
and wraps them into methods that you can call with a single line of code.
jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and
DOM manipulation.
HTML/DOM manipulation
CSS manipulation
HTML event methods
Effects and animations
AJAX
Utilities
$(document).ready(function(){
});
All the different visitors' actions that a web page can respond to are called events.
Examples:
click()
dblclick()
mouseenter()
hover()
Syntax:
$(selector).hide(speed,callback);
$(selector).show(speed,callback);
With jQuery, you can hide and show HTML elements with the hide() and show() methods:
Web Programming Lab: 8 IT 7
Three simple, but useful, jQuery methods for DOM manipulation are:
Bootstrap is a free front-end framework for faster and easier web development
Web Programming Lab: 8 IT 7
Bootstrap includes HTML and CSS based design templates for typography, forms,
buttons, tables, navigation, modals, image carousels and many other, as well as
optional JavaScript plugins
Bootstrap also gives you the ability to easily create responsive designs
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></scri
pt>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-4">
<h3>Column 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...</p>
Web Programming Lab: 8 IT 7
</div>
<div class="col-sm-4">
<h3>Column 2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...</p>
</div>
<div class="col-sm-4">
<h3>Column 3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...</p>
</div>
</div>
</div>
</body>
</html>
AIM:
Create Login Form and Validate it Username and password stored in Database
.Develop static pages (using only HTML) of an online Book store. The pages should
resemble: www.amazon.com. The website should consist of the following pages.
Home page
Registration and user Login
User profile page
PROCEDURE:
Home page
Main.html:
<html>
<head>
<title>
Web Programming Lab: 8 IT 7
Amazon</title>
</head>
<strong><h1>Welcome to AMAZON</h1></strong>
</form>
</center>
</body>
</html>
Web Programming Lab: 8 IT 7
Login.html:
<html>
<head>
<title>
login page</title>
</head>
<body bgcolor="cyan"> <center>
<strong><h1> AMAZON </h1></strong></center>
<right>
<table align="right">
<tr>
<td><h4>user name</td>
<td><input type="text" ></td>
<td></td>
</tr>
<tr>
<td><h4>password</td>
<td><input type="password"></td>
<td></td>
</tr>
<tr>
<td>
<form method="post" action="catalog.html" >
<input type="submit" value="submit" >
</form>
</td>
<td>
<form method="post" action="userpro.html" >
<input type="submit" value="register" >
<input type="reset" value="reset"></form></td>
</tr>
</table>
</body>
</html>
Web Programming Lab: 8 IT 7
Userpro.html:
<html>
<head>
<title>
login page</title>
</head>
<body bgcolor="cyan">
<center><strong><h1> AMAZON </h1></strong></center>
<form method="post" action="catalog.html" >
<right>
<table align="left">
<tr>
<td><h4>user name</td>
<td><input type="text" ></td>
<tr>
<tr>
<td><h4>password</td>
<td><input type="password"></td>
</tr>
<tr>
<td><h4>confirm password</td>
<td><input type="password"></td>
</tr>
<tr>
<td><h4>male
<option >
<input type="radio" name="sex" id="male"></td>
<td><h4>female
<input type="radio" name="sex" id="female" ></td>
</option>
</tr>
<tr>
<td>Address</td>
<td><textarea name="address" rows=5 cols=19>
</textarea>
</td>
<tr>
<td>
<input type="submit" value="submit" ></td>
<td>
<input type="reset" value="reset"></td>
</tr>
</form>
</body>
</html>
Web Programming Lab: 8 IT 7
OUTPUT:
MAIN.HTML
LOGIN.HTML
Web Programming Lab: 8 IT 7
USERPRO.HTML
CATALOG.HTML
SHOPPING.HTML
Web Programming Lab: 8 IT 7
Web Programming Lab: 8 IT 7
AIM
Create web pages to understand and use to validate user inputs.
Validate the Registration, user login, user profile and payment by credit card pages
using JavaScript.
PROCEDURE:
Home page:
Main.html:
<html>
<frameset rows="25%,*">
</frameset>
</frameset>
</html>
Top.html:
<html>
<body bgcolor="pink">
<br><br>
<marquee><h1 align=”center”><b><u>ONLINE
BOOK STORAGE</u></b></h1></marquee>
</body>
</html>
Right.html:
<html>
<body>
<br><br><br><br><br>
Web Programming Lab: 8 IT 7
<h2 align="center">
</body>
</html>
Left.html:
<html>
<body bgcolor="pink">
<h3>
<ul>
</ul>
</body>
</html>
Login.html:
<html>
<body bgcolor="pink"><br><br><br>
<script language="javascript">
Web Programming Lab: 8 IT 7
function validate()
var flag=1;
if(document.myform.id.value==""||
document.myform.pwd.value=="")
flag=0;
if(flag==1)
alert("VALID INPUT");
window.open("catalog.html","right");
else
alert("INVALID INPUT");
//document.myform.focus();
</script>
<form name="myform">
<div align="center"><pre>
</div>
</form>
</body>
</html>
Profile.html:
<html>
<body bgcolor="pink"><br><br>
<script type="text/javascript">
function validate()
var flag=1;
if(document.myform.name.value==""||
document.myform.addr.value==""||
document.myform.phno.value==""||
document.myform.id.value==""||
document.myform.pwd.value=="")
flag=0;
var str=document.myform.phno.value;
if(!(str.match(x)))
if(!(str.length==10))
flag=0;
Web Programming Lab: 8 IT 7
var str1=document.myform.id.value;
if(!(str1.match(x1)))
flag=0;
alert("Invalid UserID");
var str1=document.myform.pwd.value;
if(!(str1.match(x1)))
flag=0;
alert("Invalid password");
if(flag==1)
alert("VALID INPUT");
window.self.location.href="login.html";
else
alert("INVALID INPUT");
document.myform.focus();
</script>
Web Programming Lab: 8 IT 7
<form name="myform">
<div align="center"><pre>
</div>
<br><br>
<div align="center">
</form>
</body>
</html>
Books catalog:
Scart.html:
<html>
<body bgcolor="pink"><br><br><br>
<script language="javascript">
function validate()
var flag=1;
if(document.myform.title.value=="")
flag=0;
Web Programming Lab: 8 IT 7
str=document.myform.title.value;
if(str=="c"||str=="C")
document.myform.t1.value="C";
document.myform.t2.value=444;
else if(str=="jsp"||str=="JSP")
document.myform.t1.value="JSP";
document.myform.t2.value=555;
else
flag=0;
if(flag==1)
alert("VALID INPUT");
else
alert("INVALID INPUT");
document.myform.focus();
Web Programming Lab: 8 IT 7
</script>
</div>
<br><br>
<div align="center">
</form>
</body>
</html>
Shopping cart:
Catalog.html:
<html>
<body bgcolor="pink"><br><br><br>
<script language="javascript">
function validate()
{
var flag=1;
if(document.myform.id.value==""||
document.myform.title.value==""||
document.myform.no.value==""||
document.myform.cost.value=="")
{
Web Programming Lab: 8 IT 7
flag=0;
}
str=document.myform.title.value;
var str1=document.myform.cost.value;
if(!((str=="c"&& str1==444) || (str=="jsp" && str1==555)))
{
flag=0;
}
if(flag==1)
{
alert("VALID INPUT");
}
else
{
alert("INVALID INPUT");
document.myform.focus();
}
}
</script>
<form name="myform" action="scart.html" target="right">
<div align="center"><pre>
LOGIN ID :<input type="text" name="id"><br>
TITLE :<input type="text" name="title"><br>
NO.OF BOOKS :<input type="text" name="no"><br>
COST OF BOOK :<input type="text"name="cost"><br>
</pre><br><br>
</div>
<br><br>
<div align="center">
<input type="submit" value="ok" onClick="validate()">
<input type="reset" value="clear">
</form>
</body>
</html>
Payment.html:
<html>
<body bgcolor="pink"><br><br><br>
<script language="javascript">
function validate()
{
var flag=1;
if(document.myform.id.value==""|| document.myform.pwd.value==""||
document.myform.amount.value==""|| document.myform.num.value=="")
{
flag=0;
Web Programming Lab: 8 IT 7
}
var str=document.myform.amount.value;
var x=new RegExp("\\d","g");
if(!(str.match(x)))
{ flag=0;
}
var str1=document.myform.num.value;
var x1=new RegExp("\\d","g");
if(!(str.match(x1)))
{ flag=0;
}i
f(flag==1)
{ alert("VALID INPUT");
window.self.location.href="order.html";
} else
{
alert("INVALID INPUT");
document.myform.focus();
}}
</script>
<form name="myform">
<div align="center"><pre>
LOGIN ID :<input type="text" name="id"><br>
PASSWORD :<input type="password" name="pwd"><br>
AMOUNT :<input type="text" name="amount"><br>
CREDITCARDNUMBER :<input type="PASSWORD" name="num"><br></pre><br><br>
</div>
<br><br>
<div align="center">
<input type="button" value="ok" onClick="validate()">
<input type="reset" value="clear" >
</form>
</body>
</html>
Order Conformation
Order.html:
<html>
<head><title>order conformation</title><M/head>
<body bgcolor="cyan">
<center>
<h1><b>AMAZON</h1>
<pre><strong>
<b>Your order Is Conformed
</strong></pre>
<h2><b>THANK YOU</h2>
</center>
Web Programming Lab: 8 IT 7
</body>
</html>
Web Programming Lab: 8 IT 7
OUTPUT:
MAIN.HTML
LOGIN.HTML
Web Programming Lab: 8 IT 7
PROFILE.HTML
CATALOG.HTML
Web Programming Lab: 8 IT 7
SCART.HTML
PAYMENT.HTML
Web Programming Lab: 8 IT 7
WEEK-5.
AIM:
Write an XML file which will display the Book information which includes the following:
1) Title of the book
2) Author Name
3) ISBN number
4) Publisher name
5) Edition
6) Price
Write a Document Type Definition (DTD) to validate the above XML file. Display the XML
file as follows.
The contents should be displayed in a table. The header of the table should be in color GREY
& the Author names column should be displayed in one color and should be capitalized and
in bold. Use your own colors for remaining columns. Use XML schemas XSL and CSS for
the above purpose.
1. Books.DTD:
<!ELEMENT details (title, author, ISBN_Number, publisher, edition, price) >
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT ISBN_Number (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT edition (#PCDATA)>
<!ELEMENT price (#PCDATA)>
2. Th.CSS
.thb
{
background-color:gray;
}
.bg
{
background-color:red;
}
3. Books.XML:
<?xml version="1.0"?>
<!DOCTYPE book SYSTEM "books.dtd">
<book>
<details>
<title> C</title>
<author> BalaGuru Swami</author>
<ISBN_Number>2536</ISBN_Number>
<publisher>pearson</publisher>
<edition>2</edition>
<price>255/-</price>
</details>
<details>
Web Programming Lab: 8 IT 7
<title> C++</title>
<author> BalaGuru Swami</author>
<ISBN_Number>5236</ISBN_Number>
<publisher>pearson</publisher>
<edition>2</edition>
<price>315/-</price>
</details>
<details>
<title> E-Commerce</title>
<author> Kalakata</author>
<ISBN_Number>8562</ISBN_Number>
<publisher>pearson</publisher>
<edition>5</edition>
<price>300/-</price>
</details>
<details>
<title> CO</title>
<author> Marris </author>
<ISBN_Number>4578</ISBN_Number>
<publisher>Dream Tech</publisher>
<edition>5</edition>
<price>270/-</price>
</details>
<details>
<title> Web Technologies</title>
<author> Kumar </author>
<ISBN_Number>5423</ISBN_Number>
<publisher>Willay</publisher>
<edition>6</edition>
<price>500/-</price>
</details>
<details>
<title> Web Programming</title>
<author> Kumar </author>
<ISBN_Number>1258</ISBN_Number>
<publisher>Willay</publisher>
<edition>6</edition>
<price>500/-</price>
</details>
</book>
4. Books.HTML:
<html>
<head>
<link rel="stylesheet" type="text/css" href="th.css">
</head>
<body>
<script type="text/javascript">
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
Web Programming Lab: 8 IT 7
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","books.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.write("<table border='1'>");
var x=xmlDoc.getElementsByTagName("details")
document.write("<tr><th class='thb'>");
document.write("TITLE</th><th class='thb'>AUTHOR</th><th
class='thb'>ISBN_Number</th><th class='thb'>PUBLISHER</th><th
class='thb'>EDITION</th><th class='thb'>PRICE</th></tr>");
for (i=0;i<x.length;i++)
{
document.write("<tr><td>");
document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
document.write("</td><th class='bg'>");
document.write(x[i].getElementsByTagName("author")[0].childNodes[0].nodeValue.toU
pperCase());
document.write("</th><td>");
document.write(x[i].getElementsByTagName("ISBN_Number")[0].childNodes[0].nodeV
alue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("publisher")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("edition")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("price")[0].childNodes[0].nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
</script>
</body>
</html>
Web Programming Lab: 8 IT 7
OUTPUT:
Web Programming Lab: 8 IT 7
Q1.What is PHP?
Instead of lots of commands to output HTML (as seen in C or Perl), PHP pages contain
HTML with embedded code that does "something" (in this case, output "Hi, I'm a PHP
script!"). The PHP code is enclosed in special start and end processing
instructions <?php and ?> that allow you to jump into and out of "PHP mode."
PHP can create, open, read, write, delete, and close files on the server
PHP can collect form data
PHP can send and receive cookies
PHP can add, delete, modify data in your database
PHP can be used to control user-access
PHP can encrypt data
Ans.
<html>
<body><?php
</body>
</html>
Web Programming Lab: 8 IT 7
Ans.<html>
<body><?php
$a=10;
$b=20;
$c=$a+$b;
</html>
if($i % $j == 0)
{
$flag=1;
break;
}
}
if($flag == 0)
return 0;
else
return 1;
}
echo "<h1> PHP </h1>";
echo "<h3>Check Prime between 1 and 50 :<br></h3>";
for($i=2 ; $i<=50 ; $i++)
{
if(prime1($i) == 0)
echo "$i is Prime <br>";
else
echo "$i is Not prime <br>";
}?>
</body>
</html>
Web Programming Lab: 8 IT 7
Ans.
<html>
<body>
<?php
echo "<h1> PHP </h1>";
$a=10;
$b=20;
echo "a=$a <br>";
echo "b=$b <br>";$c = $a + $b;
echo "c = $c <br>";
if ( $a > $b && $a > $c)
echo " A is Max";
elseif($b > $c)
echo "B is Greater";
else
echo " c is greater";?>
Web Programming Lab: 8 IT 7
</body>
</html>
Ans
<html><body>
<?php
for ($i=1 ; $i<=10 ; $i++)
echo "$i<br>"?>
</body>
</html>
Web Programming Lab: 8 IT 7
Web Programming Lab: 8 IT 7
1. HTML File
<html>
<head>
<title>16egjcs089</title>
</head>
<body>
<form action="prog1.php" method = "Post">
<input type = "text" name="id" placeholder="id" required="True" ><br>
<input type = "text" name="Sname" placeholder="Name" required="True" ><br>
<input type = "text" name="Roll_NO" placeholder="Roll_NO" required="True"
><br>
<input type = "text" name="Password" placeholder="password"
required="True" >
<br>
<input type = "Submit" name="Submit" >
</form>
</body>
</html>
2. PHP file
<?php
$Server = "localhost";
$username = "root";
$password = "";
$db = "16egjcs089";
$con = mysqli_connect($server,$username,$password,$db);
if(!$con) {
die("connection failed : ".mysqli_connect_error());
}
echo $sql = "insert into student
values('".$_POST['id']."','".$_POST['Sname']."','".$_POST['Roll_NO']."','".$_POST['P
a ssword']."')";
mysqli_query($con,$sql);
mysqli_close($con);
Web Programming Lab: 8 IT 7
AIM :
1. HTML file
<!DOCTYPE html>
<html>
<head>
<title>16EGJCS089</title>
Web Programming Lab: 8 IT 7
</head>
<center>
<body>
<tr>
<td>First Name:</td>
</tr>
<tr>
<td>Last Name:</td>
</tr>
<tr>
<td>Date of birth:</td>
</tr>
<tr>
<td>Email id:</td>
</tr>
<tr>
<td>Mobile no.:</td>
Web Programming Lab: 8 IT 7
</tr>
<tr>
<td>Address:</td>
</tr>
<tr>
<td>Gender:</td>
</tr>
<tr>
<td>Country:</td>
<option value="India">India</option>
<option value="Pakistan">Pakistan</option>
<option value="England">England</option>
<option value="Australia">Australia</option>
<option value="newzealand">Newzealand</option>
</select></td>
</tr>
<tr>
<td>Hobbies:</td>
</tr>
Web Programming Lab: 8 IT 7
<div>
<table>
<tr>
<td>Qualification:</td>
<td>ScNo</td>
<td>Examination</td>
<td>Board</td>
<td>Percentage</td>
<td>Year of passing</td>
</tr>
<tr>
<td></td>
<td>1.</td>
<td>class X</td>
</tr>
<tr>
<td></td>
<td>2.</td>
<td>class XII</td>
</tr>
<tr>
Web Programming Lab: 8 IT 7
<td></td>
<td>3.</td>
<td>Graduation</td>
</tr>
<tr>
<td></td>
<td>4.</td>
<td>Masters</td>
</tr>
<tr>
<td></td>
</table>
</table>
</div></form>
</div>
</body>ss
</html>
Web Programming Lab: 8 IT 7
2. PHP file
<?php
$Server = "localhost";
$username = "root";
$password = "";
$db = "16egjcs089";
$con = mysqli_connect($server,$username,$password,$db);
if(!$con)
mysqli_query($con,$sql);
mysqli_close($con);
?>
Web Programming Lab: 8 IT 7
AIM:
Create web pages to learn how to navigate between web pages and servers.
Basic Navbar
With Bootstrap, a navigation bar can extend or collapse, depending on the screen size.
A standard navigation bar is created with the .navbar class, followed by a responsive
collapsing class: .navbar-expand-xl|lg|md|sm (stacks the navbar vertically on extra large,
large, medium or small screens).
To add links inside the navbar, use a <ul> element with class="navbar-nav". Then
add <li> elements with a .nav-item class followed by an <a> element with a .nav-link class:
Link 1
Link 2
Link 3
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
Web Programming Lab: 8 IT 7
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></scri
pt>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<h3>Basic Navbar Example</h3>
<p>A navigation bar is a navigation header that is placed at the top of the page.</p>
<p>The navbar-expand-xl|lg|md|sm class determines when the navbar should stack
vertically (on extra large, large, medium or small screens).</p>
</div>
Web Programming Lab: 8 IT 7
</body>
</html>
Web Programming Lab: 8 IT 7
Vertical Navbar
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></scri
pt>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<br>
<div class="container-fluid">
<h3>Vertical Navbar Example</h3>
<p>A navigation bar is a navigation header that is placed at the top of the page.</p>
</div>
</body>
</html>
Centered Navbar
The following example will center the navigation bar on medium, large and extra large
screens. On small screens it will be displayed vertically and left-aligned (because of the
.navbar-expand-sm class):
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<ul class="navbar-nav">
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</nav>
<br>
<div class="container-fluid">
<h3>Centered Navbar</h3>
Web Programming Lab: 8 IT 7
<p>In this example, the navbar will be centered on medium, large and extra large screens.
On small screens it will be displayed vertically and left-aligned (because of the .navbar-
expand-sm class).</p>
</div>
</body>
</html>
Colored NavbarActive
Use any of the .bg-color classes to change the background color of the navbar (.bg-
primary, .bg-success, .bg-info, .bg-warning, .bg-danger, .bg-secondary, .bg-dark and .bg-
light)
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
Web Programming Lab: 8 IT 7
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>Colored Navbar</h3>
<p>Use any of the .bg-color classes to add a background color to the navbar.</p>
<p>Tip: Add a white text color to all links in the navbar with the .navbar-dark class, or use
the .navbar-light class to add a black text color.</p>
</div>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</nav>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</nav>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</nav>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
Web Programming Lab: 8 IT 7
</li>
</ul>
</nav>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</nav>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</nav>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
Web Programming Lab: 8 IT 7
<li class="nav-item">
</li>
</ul>
</nav>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</nav>
</body>
</html>
Web Programming Lab: 8 IT 7
The Data Binding Library is a support library that allows you to bind UI components in your
layouts to data sources in your app using a declarative format rather than programmatically.
Layouts are often defined in activities with code that calls UI framework methods. For
example, the code below calls findViewById() to find a TextView widget and bind it to
the userName property of the viewModel variable:
Web Programming Lab: 8 IT 7
Use the following pages to learn how to use the Data Binding Library in your Android apps.
Get started
Learn how to get your development environment ready to work with the Data Binding
Library, including support for data binding code in Android Studio.
Binding adapters
For every layout expression, there is a binding adapter that makes the framework calls
required to set the corresponding properties or listeners. For example, the binding adapter can
take care of calling the setText() method to set the text property or call
the setOnClickListener() method to add a listener to the click event. The most common
binding adapters, such as the adapters for the android:text property used in the examples in
this page, are available for you to use in the android.databinding.adapters package. For a list
of the common binding adapters, see adapters. You can also create custom adapters, as shown
in the following example:
VIVA QUESTIONS
Q. 2 Differentiate Client side scripting and server side scripting with the help of example.
Ans. - The main difference between server-side scripting and client-side scripting is that the server
side scripting involves server for its processing. On the other hand, client-side scripting requires
browsers to run the scripts on the client machine but does not interact with the server while
processing the client-side scripts.
The client-side script executes the code to the client side which is visible to the users while a
server-side script is executed in the server end which users cannot see.
Q. 3 Explain the procedure to design HTML pages(e.g. Editors, Browsers, page format)
Ans. – 1. Open a text editor
2. Type <!Doctype html>
3. Type <html> tag
4. Type <head> tag and write code in it.
5. Type <body> tag and write code in it.
6. End all the tags as</tag>.
7. Save the file with extension .html or .htm.
8. Open web browser and view the web page.
Q. 4 What is CSS. Discuss in detail about the types of CSS.
Sol- Cascading Style Sheets (CSS) is a style sheet language used for describing the
presentation of a document written in a markup language like HTML. A CSS file has
extention .css and internet media type is text/css.CSS is designed to enable the sepration of
presentation and content, including layout, colors and fonts.
Web Programming Lab: 8 IT 7
Types of css:
Inline CSS
Internal or Embedded CSS
External CSS
Inline CSS: Inline CSS contains the CSS property in the body section attached with
element is known as inline CSS. This kind of style is specified within an HTML tag using
style attribute.
Internal or Embedded CSS: This can be used when a single HTML document must be
styled uniquely. The CSS rule set should be within the HTML file in the head section i.e the
CSS is embedded within the HTML file.
External CSS: External CSS contains separate CSS file which contains only style property
with the help of tag attributes (For example class, id, heading, …etc). CSS property written
in a separate file with .css extension and should be linked to the HTML document
using link tag. This means that for each element, style can be set only once and that will be
applied across web pages.
Q.5 What is JavaScript. Discuss types of JavaScript.
Sol-JavaScript is a web development language used to define the behavior of the web
page.There are 3 types of JavaScript:
1. Inline JavaScript: JavaScript which is defined in a tag itself is known as inline JS.
2. Internal JavaScript: JS which is defined in the head section of the html code is
known as internal JS. It is defined in the <script> tag.
External JavaScript: JavaScript which is defined in any external file is known as external
JS. The extension of that file is .js.