Professional Documents
Culture Documents
3/6/2019
Advanced Web Programming Lab
CourseNo:MCA17303CR
NIELIT
Name:________________________
Roll no:_______________________
Signature
1. Create a html page with demonstrates the use of formatting tags image tags and other
basic tags.
<html>
<head>
<title>formating_tags</title>
<style>
body{
background-color: black;
color: bisque;
font-size: 24px;
}
</style>
</head>
<body>
<h1>The text is used to implement various formatting tags</h1></br>
<b>XHTML stands for EXtensible HyperText Markup Language. </b> </br>
<strong>The XHTML 1.0 is the first document type in the XHTML family.</strong>
<i>XHTML documents can be written to operate .</i>
<em>better than they did before in existing browsers as well as in new browsers</em>
<h2>HTML <small>Small</small> Formatting</h2></br>
<h2>XHTML was developed by <mark>World Wide Web Consortium (W3C)</mark>
</h2>
<p>My favorite <ins>color</ins> is red.</p>
<p> This is <sup>superscripted</sup> text.</p>
</body>
</html>
4. Create a html form in the table layout covering major form elements
<html>
<head>
<title > Registration_from </title>
<link rel="stylesheet" a href="cist.css"
</head>
<body background ="71.jpg">
<center>
<h1> Welcome to Student Registration Form</h1><p>
</center>
<div class="container">
<form method="post" action="loginp.php" ><p>
<br>
Name : <input type="text1" name="text1" placeholder="Enter the Name " border="2"
size="35" ><br><p>
Roll no : <input type="text3" name="text1" ><br><p>
Address :<input type="text3" name="text1" ><p>
Gender <input type="radio" name ="rb"> Male
<input type="radio" name ="rb" checked="checked"> FeMale <p>
<input type="checkbox" name ="c" value="on"> C Programming
<input type="checkbox" name ="web" value="on"> web Programming<p>
Qualification :<select name="qualification">
<option name="MCA" >MCA
<option name="MBA" >MBA
<option name="BCA" >BCA
<option name="ol" selected>O Level
</select>
</div>
<center>
<input type="Submit" name="bt" value="Save" class="myclass">
</center>
</form>
</body>
</html>
5. Create a html page with links in one frame and the linked page opens in the other frame.
6. Make use of tables as the layout of the web page.
Week 4:
1 Create a Navigation bar (with dropdown) with CSS.
<html >
<head>
<style type="text/css">
nav {
display: block;
position: absolute;
top: 0;
width: 100%;
background-color: green;
}
li{
list-style-type: none;
display: inline;
margin-right: 20px;
font-size:25px
}
a:link {
color: #fff;
text-decoration: none;
}
a:hover {
color: orange;
text-decoration: none;
}
li > ul {
display: none
}
li:hover ul {display: block; position: absolute; left:200px;background-
color:green;margin:0;}
li:hover ul li a:link{display: block;margin-left:-30px;}
</style>
</head>
<body>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li>
<a href="#">Products</a>
<ul>
<li><a href="#">Engineering</a></li>
<li><a href="#">Telecom</a></li>
<li><a href="#">Energy</a></li>
<li><a href="#">Finance</a></li>
<li><a href="#">Consultancy</a></li>
</ul>
</li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</body>
</html>
1 CSS Grid
<html >
<head>
<title> create a CSS Grid</title>
<style type="text/css">
.container, .row {
width: 100%;
}
.row:before, .row:after {
display: table;
content: "";
}
.row:after {
clear: both;
}
.col1, .col2, .col3 {
float: left;
width:25.333333333%;
margin:1%;
padding:1%;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col1">
<p>XHTML stands for EXtensible HyperText Markup Language. It is the next step in
the evolution of the internet. The XHTML 1.0 is the first document type in the XHTML
family.p>
</div>
<div class="col2">
<p>XHTML is almost identical to HTML 4.01 with only few differences. This is a
cleaner and stricter version of HTML 4.01. If you already know HTML, then you need to
give little attention to learn this latest version of HTML.</p>
</div>
<div class="col3">
<p>XHTML documents can utilize applications such as scripts and applets that rely upon
either the HTML Document Object Model or the XML Document Object Model.</p>
</div>
</div>
</div>
</body>
</html>
<html >
<head>
<title> create a sticky footer</title>
<style type="text/css">
.footer {
position:fixed;
bottom:0;
display:block;
width:100%;
background-color: red;
color: #fff;
}
</style>
</head>
<body>
<p>
XHTML defines quality standard for your webpages and if you follow
that,
then your web pages are counted as quality web pages.
The W3C certifies those pages with their quality stamp. </p>
<div class="footer">
<p>I will be stuck here.</p>
</div>
</body>
</html>
2 Create a CSS3 based Zebra striped table,
<html>
<head>
<title>HTML CSS exercise - CSS3 Zebra Striping a Table</title>
<style type="text/css">
table {
border:1px solid silver
}
th {
background-color: #ccc;
}
tbody tr:nth-child(even) {
background-color: #abe113;
}
</style>
</head>
<body>
<table>
<tr><th>Id</th><th>Name</th><th>Major</th></tr>
<tr><td>1001</td><td>Gopl Murthy</td><td>Physics</td></tr>
<tr><td>1002</td><td>Joy Sen</td><td>Economics</td></tr>
<tr><td>1003</td><td>Chandu Yadav</td><td>Chemistry</td></tr>
<tr><td>1004</td><td>Shalini Gupta</td><td>Zoology</td></tr>
<tr><td>1004</td><td>Vivek Kumar</td><td>Math</td></tr>
<tr><td>1004</td><td>Sameer Ali</td><td>Botany</td></tr>
</table>
</body>
</html>
3 CSS3 based button
<!doctype html>
<html>
<head>
<title>HTML CSS Exercise - create button with CSS3</title>
<style>
button {
width: 200px;
padding:8px;
background-color: #428bca;
border-color: #357ebd;
color: #fff;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px; /* future proofing */
-khtml-border-radius: 10px; /* for old Konqueror browsers */
text-align: center;
vertical-align: middle;
border: 1px solid transparent;
font-weight: 900;
font-size:125%
}
</style>
<title>Untitled Document</title>
</head>
<body>
<button>Subscribe Now</button>
</body>
</html>
3 CSS3 image rounded shape
<html>
<head>
<title>HTML CSS Exercise - make an image rounded with CSS3</title>
<style>
.rounded-img {
border-radius: 50%
}
</style>
</head>
<body>
<img data-src="holder.js/140x140" class="rounded-img" alt="140x140" src="muneer.jpg+"
style="width: 140px; height: 140px;">
</body>
</html>
4 Create a stitched look,
<html lang="en">
<head>
<title>Create a Stiched Look with CSS3</title>
<style>
.stitched {
width: 200px;
padding: 20px;
margin: 10px;
background: #0d90df;
color: #fff;
font-size: 21px;
font-weight: bold;
line-height: 1.3em;
border: 2px dashed #fff;
border-radius: 10px;
box-shadow: 0 0 0 4px #0d90df, 2px 1px 6px 4px rgba(10, 10, 0, 0.5);
text-shadow: -1px -1px #aa3030;
font-weight: normal;
}
</style>
</head>
<body>
<div class="stitched"></div>
</body>
</html>
II CSS3 Corner Ribbon,
<html >
<head>
<title>Corner Ribbon with CSS3 Example</title>
<style type="text/css">
.ribbon {
background-color: #a00;
overflow: hidden;
white-space: nowrap;
position: absolute;
left: -50px;
top: 40px;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-box-shadow: 0 0 10px #888;
-moz-box-shadow: 0 0 10px #888;
box-shadow: 0 0 10px #888;
}
.ribbon a {
border: 1px solid #faa;
color: #fff;
display: block;
font: bold 100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
margin: 1px 0;
padding: 10px 50px;
text-align: center;
text-decoration: none;
/* for creating shadow */
text-shadow: 0 0 5px #444;
}
</style>
</head>
<body>
<div class="ribbon">
<a href="#">Best value pack</a>
</div>
</body>
</html>
III CSS3 blurry text effect,
<html>
<head>
<title>Blurry text with CSS3</title>
<style type="text/css">
p{
color:#000000;
font-size:50px;
font-family:arial;
text-shadow: 0 0 3px #000000,
3px 0 3px #000000,
0 3px 3px #000000,
-3px 0 3px #000000,
0 -3px 3px #000000;
}
</style>
</head>
<body>
<p>This text is blurred</p>
</body>
</html>
d.CSS3 speech bubble shape
<html >
<head>
<title>Create a speech bubble shape with CSS3</title>
<style type="text/css">
#speech-bubble {
width: 120px;
height: 80px;
background: #5ac4ed;
position: absolute;
left:100px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#speech-bubble:before {
content:"";
position: absolute;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 26px solid #5ac4ed;
border-bottom: 13px solid transparent;
margin: 13px 0 0 -25px;
}
</style>
</head>
<body>
<div id="speech-bubble"></div>
</body>
</html>
5. Image cross effect with CSS3 transition
<html >
<head>
<meta charset=utf-8>
<title>Image cross effect with CSS3 transition</title>
<style type="text/css">
.changer img { transition: 1s ease-in-out; }
img.step1, div.changer:hover img.step2 { opacity: 1.0; }
.changer:hover img.step1, img.step2 { opacity: 0; }
</style>
</head>
<body>
<div class="changer">
<img class="step1" style="position: absolute;" src="https://www.w3resource.com/html-
css-exercise/pic1.png" alt="">
<img class="step2" src="https://www.w3resource.com/html-css-exercise/pic2.png"
alt="">
</div>
</body>
</html>
b. Google Font,
<html >
<head>
<title>Use Google Font exercise</title>
<link href='http://fonts.googleapis.com/css?family=Indie+Flower' rel='stylesheet'
type='text/css'>
<style type="text/css">
p{
font-family: 'Indie Flower', cursive;
}
</style>
</head>
<body>
<p>SQL tutorial of w3resource is a comprehensive tutorial to learn SQL. We have
followed SQL:2003 standard of ANSI. There are hundreds of examples given in this
tutorial. Output are shown with Oracle 10G. Often outputs are followed by pictorial
presentation and explanation for better understanding</p>
<script type="text/javascript">
WebFontConfig = {
google: { families: [ 'Indie+Flower::latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
</body>
</html>
Font Awesome Vector Icons with
Bootstrap3
<html>
<head>
<title> Use Font Awesome Vector Icons with Bootstrap 3</title>
<link rel="stylesheet"
href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"
rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="btn-group open">
<a class="btn btn-primary" href="#"><i class="fa fa-user fa-fw"></i> User</a>
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#">
<span class="fa fa-caret-down"></span></a>
<ul class="dropdown-menu">
<li><a href="#"><i class="fa fa-pencil fa-fw"></i> Edit</a></li>
<li><a href="#"><i class="fa fa-trash-o fa-fw"></i> Delete</a></li>
<li><a href="#"><i class="fa fa-ban fa-fw"></i> Ban</a></li>
<li class="divider"></li>
<li><a href="#"><i class="i"></i> Make admin</a></li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
Calculating Values With CSS3 calc().
<html>
<head>
<title>HTML CSS Exercise - calculating values with CSS3</title>
<style type="text/css">
.container{
/* Calculate the width */
width: calc(500px - 10%);
background-color:#ec8007;
color:#fff;
text-align:center;
padding:10px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="container">
<p>CSS3 <em>calc</em> example</p>
</div>
</body>
</html>
Week 5
1. Write a JavaScript program to sum the multiples of 3 and 5 under 1000 ?
<html>
<head>
<title>week_5_1</title>
</head>
<body>
<script type="text/javascript">
var n=prompt("Enter the Uper limit" );
var sum=0;
var count=0;
for(i=1;i<n;i++)
{
if(i%3==0 || i%5==0)
{
count++;
document.write("\t"+i);
sum=sum+i;
}
}
document.write("</br></br>The total numbers multiples of 3 and 5 Under 1000 :"+count);
document.write("</br> the sum="+sum);
</script>
</body>
</html>
3. Write a JavaScript function to test whether a string ends with a specified string
<html>
<head>
</head>
<body>
<script>
</body>
</html>
5. Write a program using Java Script that checks if two matrices have identical values in
all the elements.
<html>
<head>
<title>matrices_comparision</title>
</head>
<body>
<script type="text/javascript">
document.write("<h1> This Javascript is used to Check if two matrices are Equal</br>");
var mat1 =[
["One" ,"Two","Three"],
["Four" ,"Five" ,"Six"],
["Seven","Eight","Nine"]
];
var mat2 = [
['apple', 'orange', 'pear'],
['carrots', 'beans', 'peas'],
['cookies', 'cake', 'muffins',]
];
for (i=0; i <3; i++)
{
for (j=0; j <3; j++) {
if(mat1[i][j] !=mat2[i][j])
{
document.write("<h2> Matrices are not Equal</h2>")
break;
}
else{
document.write("<h3>Matrices are not Equal</h3></br>");
break;
}
}
}
</script>
</body>
</html>
6. Write a JavaScript program to check a credit card number and validate an email address?
<html>
<head>
<title>regexp</title>
<style type="text/css">
input{
padding: 20px;
width: 30%;
height: 10px;
color: blue;
font-weight: bold;
border-radius: 20px;
margin-left: 200px;
button{
text-align: center;
padding: 20px;
width: 20%;
height: 20px;
color: blue;
font-weight: bold;
border-radius: 20px;
margin-left: 200px;}
</style>
</head>
<body>
<script type="text/javascript">
function check_email()
var mail=document.getElementById("email").value;
if(email.test(mail))
else
</script>
</body>
</html>
Week 6:
1.
a. Change button text using jQuery
<html>
<head>
<title>week_6_1</title>
<script src="jquery-3.3.1.js"></script>
</head>
<body>
<input style="color: blue;font-size: 22px;font-weight: bold;
margin-left: 400px" type="button" name="btn1" value="Click Me" id="btn1">
<script type="text/javascript">
$(document).ready(function(){
$('#btn1').click(function(){
$('#btn1').attr({value:"Wow Zahid we changed button"});
});
});
</script>
</body>
</html>
<?php
$name = $_POST['name'];
echo "<h3> Hello $name </h3>";
?>
<html>
<head>
<style>
body,input{
padding:15px;
color:black;
font-size:33px;
}
</style>
<title>access_html_form</title>
</head>
<body>
<form method='POST' action="week71.php">
<h2>Please input your name:</h2>
<input type="text" name="name" id="name"><br>
<input type="submit" value="Submit Name">
</form>
</body>
</html>
2. Write a PHP program to check the bits of the two given positions of a number are same
or not.
<?php
function test_bit_position($num, $pos1, $pos2) {
$pos1--;
$pos2--;
$bin_num = strrev(decbin($num));
if ($bin_num[$pos1] == $bin_num[$pos2]) {
return "true";
} else {
return "false";
}
}
echo test_bit_position(112,5,6)."\n";
?>
4. Write a PHP program to compute the sum of the prime numbers less than 100
<?php
primeno(100);
function primeno($n)
{
$sum=0;
for($i=1;$i<=$n;$i++){ //numbers to be checked as prime
$counter = 0;
for($j=1;$j<=$i;$j++){ //all divisible factors
if($i % $j==0){
$counter++;
}
}
//prime requires 2 rules ( divisible by 1 and divisible by itself)
if($counter==2){
print $i." is Prime <br/>";
$sum=$sum+$i;
}
}
echo ($sum);
}
?>
</form>
<?php
$num= $_POST['num'];
//$num =5;
$fact= 1;
for($i=1;$i<=$num;$i++){
$fact=$fact*$i;
}
echo" The Factorial of Number $num =$fact </br>";
?>
</body>
</html>
2. Write a PHP script using nested for loop that creates a chess board?
<!DOCTYPE html>
<html>
<head>
<title>week_8_2</title>
<style>
body{
background-color :grey;
}
h3{
font-size:24px;
color:blue;
}
table{
border:10px solid yellow;
}
</style>
</head>
<body>
<center>
<h3>Chess Board using Nested For Loop</h3>
Week 9
1. Write a simple PHP class which displays an introductory message like "Hello All,
I am Scott", where "Scott" is an argument value of the method within the class.
<?php
class person
{
public $name,$n;
function set_name($new_name)
{
$str ="Hello All, I am ";
$this->name = $new_name;
$this->n=$str.$new_name;
}
function display(){
echo "</br>$this->n";
}
}
$p = new person();
$p->set_name("Scott");
$p->display();
?>
for($i=1;$i<=$n;$i++)
{
$fact=$fact *$i;
}
echo"<h1 class='mystyle'> The Factorial of Number $n =$fact </h1></br>";
}
}
$f = new factorial();
$f->fact(9);
?>
</body></html>
3. Write a PHP class that sorts an ordered integer array with the help of sort()
function.
Sample array : array(11, -2, 4, 35, 0, 8, -9)
Output : Array ( [0] => -9 [1] => -2 [2] => 0 [3] => 4 [4] => 8 [5] => 11 [6] => 35 )
<!DOCTYPE html>
<html>
<head>
<title>week_9_3</title>
<style >body{font-size:40px;}</style>
</head>
<body>
<?php
class arraysort{
function display(){
$myarry= array(1,-2,4,35,0,8,9,55);
$len= count($myarry);
sort($myarry);
print_r($myarry);
}
}
$obj =new arraysort;
$obj->display();
?>
</body>
</html>
4. Calculate the difference between two dates using PHP OOP approach. Sample Dates :
1981-11-03,2013-09-04 Expected Result : Difference : 31 years, 10 months, 1 days
<?php
$interval = $sdate->diff($edate);
echo "Difference : " . $interval->y . " years, " . $interval->m." months, ".$interval->d." days ";
?>
5. Write a PHP Calculator class which will accept two values as arguments, then add them,
subtract them,
multiply them together, or divide them on request. For example :
$mycalc = new MyCalculator( 12, 6);
echo $mycalc- > add(); // Displays 18
echo $mycalc- > multiply(); // Displays 72
<?php
class MyCalculator {
$this->_fval = $fval;
$this->_sval = $sval;
?>
echo $dt;
?>
Week 10
1. Write a PHP script to get time difference in days and years, months, days, hours, minutes,seconds
<?php
$month_num = 7;
$month_name = date("F", mktime(0, 0, 0, $month_num, 10));
echo $month_name."\n";
?>
3. Write a PHP script to get yesterday's date.
<?php
<?php
date_default_timezone_set('America/Los_Angeles');
$date = date('m/d/Y h:i:s a', time());
echo $date;
?>
5. Write a PHP script to check if a date is a weekend or not.
<?php
$dt='2011-01-04';
$dt1 = strtotime($dt);
$dt3 = strtolower($dt2);
else
}
?>
6. Write a PHP script to add/subtract the number of days from a particular date
<?php
$dt='2011-01-01';
$no_days = 40;
?>
8. Write a PHP function to get start and end date of a week (by week number) of a particular year
<?php
$time += ((7*$week)+1-$day)*24*3600;
$time += 6*24*3600;
return $dates;
$result = Start_End_Date_of_a_week(12,2014);
?>
1: Write a query to display the name (first_name, last_name) and salary for all employees whose
salary is not in the range $10,000 through $15,000.
2: Write a query to display the name (first_name, last_name) and department ID of all
employees in departments 30 or 100 in ascending order.
REPEAT('$', FLOOR(salary/1000))
'SALARY($)', salary
FROM employees
ORDER BY salary DESC;
30. Write a query to display the employees with their code, first name, last name and hire
date who hired either on seventh day of any month or seventh month in any year.
SELECT employee_id,first_name,last_name,hire_date
FROM employees
WHERE POSITION("07" IN DATE_FORMAT(hire_date, '%d %m %Y'))>0;