Practical No 1
Practical No 1
(315606)
Practical No: 1
Tag Description
<!DOCTYPE> Defines the document type
Page | 1
WEB DEVELOPMENT ER NO:211240116059
(315606)
Formatting
Tag Description
Not supported in HTML5. Use <abbr> instead.
<acronym> Defines an acronym
<abbr> Defines an abbreviation or an acronym
Defines contact information for the author/owner of a
<address> document/article
<b> Defines bold text
Isolates a part of text that might be formatted in a different direction
<bdi> from other text outside it
<bdo> Overrides the current text direction
Not supported in HTML5. Use CSS instead.
<big> Defines big text
<blockquote> Defines a section that is quoted from another source
Page | 2
WEB DEVELOPMENT ER NO:211240116059
(315606)
Tag Description
<form> Defines an HTML form for user input
<input> Defines an input control
<textarea> Defines a multiline input control (text area)
<button> Defines a clickable button
<select> Defines a drop-down list
<optgroup> Defines a group of related options in a drop-down list
<option> Defines an option in a drop-down list
<label> Defines a label for an <input> element
<fieldset> Groups related elements in a form
Page | 3
WEB DEVELOPMENT ER NO:211240116059
(315606)
Tag Description
<frame> Not supported in HTML5.
Frames
Defines an alternate content for users that do not support frames
Images
Tag Description
<img> Defines an image
<map> Defines a client-side image-map
<area> Defines an area inside an image-map
<canvas> Used to draw graphics, on the fly, via scripting (usually JavaScript)
<figcaption Defines a caption for a <figure> element
>
<figure> Specifies self-contained content
<picture> Defines a container for multiple image resources
<svg> Defines a container for SVG graphics
Audio / Video
Tag Description
<audio> Defines sound content
Page | 4
WEB DEVELOPMENT ER NO:211240116059
(315606)
Defines multiple media resources for media elements (<video>, <audio> and
<source <picture>)
>
<track> Defines text tracks for media elements (<video> and <audio>)
<video> Defines a video or movie
Links
Ta Description
g
<a> Defines a hyperlink
Defines the relationship between a document and an external resource (most
<link> used to link to style sheets)
<nav> Defines navigation links
Lists
Tag Description
<ul> Defines an unordered list
<ol> Defines an ordered list
<li> Defines a list item
<dir> Not supported in HTML5. Use <ul> instead.
Defines a directory list
<dl> Defines a description list
<dt> Defines a term/name in a description list
<dd> Defines a description of a term/name in a description list
Tables
Tag Description
<table> Defines a table
<caption> Defines a table caption
<th> Defines a header cell in a table
<tr> Defines a row in a table
<td> Defines a cell in a table
<thead> Groups the header content in a table
<tbody> Groups the body content in a table
<tfoot> Groups the footer content in a table
Specifies column properties for each column within a <colgroup> element
<col>
<colgroup Specifies a group of one or more columns in a table for formatting
>
Page | 5
WEB DEVELOPMENT ER NO:211240116059
(315606)
Meta Info
Tag Description
<head> Defines information about the document
<meta> Defines metadata about an HTML document
<base> Specifies the base URL/target for all relative URLs in a document
Not supported in HTML5. Use CSS instead.
<basefont> Specifies a default color, size, and font for all text in a document
Programming
Tag Description
<script> Defines a client-side script
Defines an alternate content for users that do not support client-side scripts
<noscript>
<applet> Not supported in HTML5. Use <embed> or <object> instead.
Defines an embedded applet
<embed> Defines a container for an external (non-HTML) application
<object> Defines an embedded object
<param> Defines a parameter for an object
Page | 6
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-2
<html>
<head><title>Practical-2</title></head><body style="background-color:powderblue;">
<p><h3>List Formatting</h3></p>
<ol type="a">
<li>Playing Cricket</li>
<li>Playing volleyball</li>
<li>Playing Pool</li>
<li>Playing Basketball</li>
</ol>
<ul type="square">
<li>Pani-Puri</li>
<li>Pizza</li>
<li>Chinese</li>
<li>Maxican</li>
</ul>
<p> TYPES OF TEA/COFFEE (nested list)</P>
<ul>
<li>Coffee</li>
</body>
</html>
Page | 7
WEB DEVELOPMENT ER NO:211240116059
(315606)
Output:-
<ul>
<li>NESCAFE</li>
<li>Cappacini</li>
</ul>
<li>Tea</li>
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
Page | 8
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Practical</title>
<style>
.color4{ background-color:burlywood; }
</style>
</head>
<body>
<div>
<tr>
<tr>
<th>Name</th>
Page | 9
WEB DEVELOPMENT ER NO:211240116059
(315606)
<th>Email</th>
<th>Phone</th>
<th>Floor/Block</th>
</tr>
<tr>
<td class="color1">Fred</td>
<td class="color2">[email protected]</td>
<td class="color1">123456</td>
</tr>
<tr>
<td class="color2">Jon</td>
<td class="color1">[email protected]</td>
<td class="color2">123457</td>
</tr>
<tr>
<td class="color1">Bill</td>
<td class="color2">[email protected]</td>
<td class="color1">123489</td>
</tr>
<tr>
<td class="color2">Jane</td>
<td class="color1">[email protected]</td>
<td class="color2">128589</td>
Page | 10
WEB DEVELOPMENT ER NO:211240116059
(315606)
</tr>
<tr>
<td class="color1">Alison</td>
<td class="color2">[email protected]</td>
<td class="color1">123458</td>
</tr>
</table>
</div>
</body>
</html>
Output: -
Page | 11
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-4
frame1.html frame2.html
<html> <html>
<body <body style="background-
style="background- color:red;">
color:cyan;"> <h1>here is
<h1>look in the box at the some information</h1>
right for some inforation</h1> </body>
</body> </html>
</html>
frame3.html frame4.html
<html> <html>
<body style="background- <body
color:blue;"> style="background-
<H1>This is header.</H1> color:purple;">
</body> <H1>This is footer.</H1>
</html> </body>
</html>
Main Code:
<html>
<head>
<title>frameset</title>
</head>
<frameset rows="10%,20%,*">
<frame src="frame3.html">
<frameset cols="30%,70%,*">
<frame src="frame1.html">
<frame src="frame2.html">
</frameset>
Page | 12
WEB DEVELOPMENT ER NO:211240116059
(315606)
<frameset s="50%,50%,*">
<frame src="frame4.html">
</frameset>
</html>
Output:
Page | 13
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-5
Aim: Create a HTML5 web page which shows the use of Canvas.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Canvas</title>
</head>
<body>
<script>
var c =
document.getElementById("myCanvas");
varctx = c.getContext("2d");
ctx.beginPath();
ctx.stroke();
roman"; ctx.strokeText("Hello
ctx.moveTo(400,100);
ctx.lineTo(100,500);
Page | 14
WEB DEVELOPMENT ER NO:211240116059
(315606)
ctx.moveTo(100,100);
ctx.lineTo(400,500);
ctx.stroke();
</script>
</body>
</html>
Output:
Page | 15
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-6
Aim: Create a HTML5 web page which shows the use of Audio & Video.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body align="center">
<h1>GTU University</h1>
<hr>
<audio controls>
<source src="audio1.mp3"
</audio>
<hr>
<source src="video.mp4"
Page | 16
WEB DEVELOPMENT ER NO:211240116059
(315606)
</video>
</body>
</html>
Output:
Page | 17
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-7
Aim: Create a student registration form using the following tags <form>,
<input>, <textarea>, <button>, <select>, <option>The registration form
must consist of following information:
First Name, Middle Name, Last Name, Gender (use radio button), Address,
Phone No., email id, Hobbies (use checkbox), City, State, Country, College
Name (use dropdown menu)
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
</head>
<body>
<form>
<table>
</tr>
</tr>
Page | 18
WEB DEVELOPMENT ER NO:211240116059
(315606)
<tr>
</tr> <tr>
<td>Address :</td>
</tr>
<tr>
<td><select>
<option>91</option>
<option >92</option>
<option >93</option>
<option>94</option>
<option >95</option>
</select>
</tr> <tr>
</tr>
<tr>
<td> Hobbies :
</td>
Page | 19
WEB DEVELOPMENT ER NO:211240116059
(315606)
<tr>
</tr>
</tr>
<td>
</td>
</tr>
<tr>
<td>College :
</td>
<option value="SPCE">SPCE</option>
<option value="nirma">Nirma</option>
<option value="LD">LD</option>
</select></td>
Page | 20
WEB DEVELOPMENT ER NO:211240116059
(315606)
</tr>
<tr>
</tr>
</table>
</form>
</body>
</html>
Output:
Page | 21
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-8
Aim: - Design a simple form to register for new user including username, password,
email, mobile number, gender, hobbies and address using CSS.
<!DOCTYPE html>
<html>
<style>
input[type=text],
select { width:
50%;
padding: 12px
20px; margin:
8px 0; display:
inline-block;
border: 1px
solid #ccc;
border-radius:
4px;
box-sizing: border-box;
input[type=su
bmit] {
width:
100%;
background-color:
#4CAF50; color:
white;
Page | 22
WEB DEVELOPMENT ER NO:211240116059
(315606)
padding:
14px 20px;
margin: 8px
0; border:
none;
border-
radius: 4px;
cursor:
pointer;
}
input[type=submit]:hove
r { background-color:
#45a049;
div {
border-radius: 5px;
background-color:
#f2f2f2; padding:
20px;
</style>
<body>
<div>
<form action="/action_page.php">
Page | 23
WEB DEVELOPMENT ER NO:211240116059
(315606)
<p> </p>
<p> </p>
<label for="lname">Password</label>
<p> </p>
<label for="email">Address</label>
<p> </p>
<form>
<label for="html">MALE</label><br>
<label for="css">FEMALE</label><br>
<p> </p>
<label for="hobbies">Hobbies</label>
<p> </p>
<form>
<label for="vehicle1">Reading</label><br>
Page | 24
WEB DEVELOPMENT ER NO:211240116059
(315606)
<label for="vehicle2">Swimming</label><br>
<label for="vehicle3">Singing</label>
</form>
</form>
</div>
</body>
</html>
Output:
Page | 25
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-9
Aim:-Create HTML page to create menu using HTML and CSS.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<stye
l>
body
{
marg
in: 0;
font-family: Arial, Helvetica, sans-serif;
}
.topnav {
overflow:
hidden;
background-color: #333;
}
.topnav
a{
float:
left;
color:
#f2f2f2
;
text-align:
center;
padding: 14px
16px; text-
decoration:
none; font-
size: 17px;
}
.topnav a:hover {
background-
color: #ddd;
color: black; }
Page | 26
WEB DEVELOPMENT ER NO:211240116059
(315606)
.topnav a.active {
background-color:
#04AA6D; color:
white;
} </style> </head> <body>
<div class="topnav">
<a href="#news">News</a>
<a href="#about">More</a>
</div>
</body>
</html>
Output:
Page | 27
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical – 10
AIM : Write a program to display the calendar using javascript code by getting
the year from the user.
<html>
<head>
<script
language="javascript">
function
day_title(day_name)
{
document.write("<td align=center width=35
bgcolor=lightblue><b>"+day_name+"</b></td>");
}
function fill_table(month,month_len)
{
day=1;
document.write("<table border=1 cellspacing=3 cellpadding=3%>");
document.write("<td colspan=7 align=center bgcolor=red><b>"+month+"
"+year+"</b><tr>"); day_title("Sun");
day_title("Mon");
day_title("Tue");
day_title("Wed");
day_title("Thu");
day_title("Fri");
day_title("Sat");
document.write("</tr>
<tr>"); for(var i=1;
i<start_day;i++)
{
document.write("<td>");
Page | 28
WEB DEVELOPMENT ER NO:211240116059
(315606)
}
for(var i=start_day; i<8;i++)
{
document.write("<td align=center
bgcolor=silver>"+day+"</td>"); day++;
}
document.write("
<tr>");
while(day<=mont
h_len)
{
for(var i=1; i<=7 && day<=month_len;i++)
{
document.write("<td align=center
bgcolor=silver>"+day+"</td>"); day++;
}
document.write("
<tr>");
start_day=i;
}
document.write("</tr></table><br>");
}
year=prompt("enter 4 digit year
",2016); today=new
Date("January 1, "+year);
start_day=today.getDay()+1;
fill_table("January", 31);
if (year%4==0)
fill_table("February
", 29); else
Page | 29
WEB DEVELOPMENT ER NO:211240116059
(315606)
fill_table("February", 28);
fill_table("March", 31);
fill_table("April", 30);
fill_table("May", 31);
fill_table("June", 30);
fill_table("July", 31);
fill_table("August", 31);
fill_table("September", 30);
fill_table("October", 31);
fill_table("November", 30);
fill_table("December", 31);
</script>
</head>
</html>
OUTPUT :
Page | 30
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical – 11
AIM : Write a program To create a html registration form and to validate the form using
javascript code.
<html>
<script >
function
reset1()
{
x=confirm("It will clear all the text
entered") if(x==true)
{
document.form1.t0.value=""
document.form1.t1.value=""
document.form1.t2.value=""
document.form1.ta.value=""
document.form1.t3.value=""
document.form1.t4.value=""
document.form1.country.value=""
document.form1.r1[0].checked=false
document.form1.r1[1].checked=false
document.form1.c1.checked=false
document.form1.c2.checked=false
document.form1.c3.checked=false
document.form1.c4.checked=false
document.form1.t1.focus()
}
}
function check()
{
var
ee=document.form1.t0.val
Page | 31
WEB DEVELOPMENT ER NO:211240116059
(315606)
ue; var
atpos=ee.indexOf("@");
var dotpos=ee.lastIndexOf(".");
if(atpos<1||dotpos<atpos+2||dotpos+2>=ee.length)
{
alert("please enter a valid
email id")
document.form1.t0.value=""
document.form1.t0.focus()
}
else if((document.form1.t1.value=="")||(!(isNaN(document.form1.t1.value))))
{
alert("please enter the correct
name")
document.form1.t1.value=""
document.form1.t1.focus()
}
else if((document.form1.t2.value=="")||(isNaN(document.form1.t2.value)))
{
alert("please enter the age
correctly")
document.form1.t2.value=""
document.form1.t2.focus()
}
else if((document.form1.t2.value>40)||(document.form1.t2.value<18))
{
limits") document.form1.t2.value=""
document.form1.t2.focus()
Page | 32
WEB DEVELOPMENT ER NO:211240116059
(315606)
else if(document.form1.ta.value=="")
address")
document.form1.ta.focus
()
else if((document.form1.r1[0].checked==false)&&(document.form1.r1[1].checked==false))
Female")
document.form1.r1[0].focus()
else if((document.form1.country.value==""))
document.form1.country.focus()
else
if((document.form1.c1.checked==false)&&(document.form1.c2.checked==false)&
& (document.form1.c3.checked==false))
Page | 33
WEB DEVELOPMENT ER NO:211240116059
(315606)
known") document.form1.c1.focus()
else if(document.form1.t3.value=="")
password")
document.form1.t3.focus()
else if(document.form1.t4.value=="")
password")
document.form1.t4.focus()
else if(document.form1.t4.value!=document.form1.t3.value)
password") document.form1.t3.focus()
else
if((document.form1.t0.value!="")&&(document.form1.t1.value!="")&&(document.form1.t2.
value
!="
Page | 34
WEB DEVELOPMENT ER NO:211240116059
(315606)
")&&
(document.form1.t3.value!="")&&(document.form1.t4.value!="")&&(document.form1.ta.val
ue!= "")
&&
((document.form1.r1[0].checked!=false)||(document.form1.r1[0].checked!=false))&&((docu
ment. for
m1.c1.checked!
=false)||(document.form1.c2.checked!=false)||(document.form1.c3.checked!=false)||(docume
nt.for m1.
c4.checked!=false)||
(document.form1.c5.checked!=false)))
form") if(x)
document.lay.visibility="show"
return false;
</script>
onload=document.form1.t0.focus()
Page | 35
WEB DEVELOPMENT ER NO:211240116059
(315606)
onsubmit="return check()"><center>
<h2>ENTRY FORM</h2></center>
name=t0
size=18>
name=t1 size=18>
name=ta rows=5
cols=15></textarea>
value="female">Female<br>
<option value="AF">India</option>
<option value="AL">Canada</option>
<option value="DZ">Australia</option>
<option value="AS">Russia</option>
Page | 36
WEB DEVELOPMENT ER NO:211240116059
(315606)
<option value="AD">USA</option>
</select></td>
than one)</center>
</td>
name=t4 size=18>
</table>
<center>
</form>
</body>
</html>
Page | 37
WEB DEVELOPMENT ER NO:211240116059
(315606)
OUTPUT :
Page | 38
WEB DEVELOPMENT ER NO:211240116059
(315606)
Page | 39
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-12
Aim: Implement 2D transformation on Web page.
<html>
<head>
<title>Web programming Practical-10</title>
<style>
div#h1
{
width:
200px;
height:
100px;
background-
color: pink;
border: 1px solid
black;
-ms-transform:
translate(50px,100px);
transform:
translate(50px,100px);
}div#h
2{
width:
200px;
height:
100px;
Page | 40
WEB DEVELOPMENT ER NO:211240116059
(315606)
background-color:
lightblue; border: 1px
solid black;
-ms-transform:
rotate(20deg);
transform:
rotate(20deg);}
div#h3{
width:
200px;
height:
100px;
background-
color: pink;
border: 1px solid
black;
-ms-transform: scale(0.5,0.5);
transform:
scale(0.5,0.5);}
div#h4{
width:
200px;
height:
100px;
background-color:
lightblue; border: 1px
solid black;
Page | 41
WEB DEVELOPMENT ER NO:211240116059
(315606)
-ms-transform:
skew(20deg,10deg);
transform:
skew(20deg,10deg);}
div#h5{
width:
200px;
height:
100px;
background-
color:pink;
border: 1px
solid black;
-ms-transform: matrix(1, -0.2, 0, 1, 0, 0);
solid black;
Page | 42
WEB DEVELOPMENT ER NO:211240116059
(315606)
-ms-transform:
scaleX(2);
transform:
scaleX(2);
}
div#h7{
margin:
150px;
width:
200px;
height:
100px;
background-
color: pink;
border: 1px solid
black;
-ms-transform:
scaleY(0.5);
transform:
scaleY(0.5);
}
div#h8
{
width:
200px;
height:
100px;
Page | 43
WEB DEVELOPMENT ER NO:211240116059
(315606)
background-color:
lightblue; border: 1px
solid black;
-ms-transform:
skewX(20deg);
transform:
skewX(20deg);
}div#h9{ width:
200px; height: 100px;
background-
color: pink;
-ms-transform: skewY(-
20deg); transform:
skewY(-20deg);
}</style>
</head><body>
<p>rotate</p>
<br><br>
<div id="h2">Hello</div>
<p>scale</p>
<div id="h3">Web Programming</div>
<p>skew</p>
<div id="h4">Compiler Design</div>
<p>matrix</p>
<div id="h5">Cryptography</div><br><br>
Page | 44
WEB DEVELOPMENT ER NO:211240116059
(315606)
<p>translate</p>
<div id="h1">Programming</div>
<br><br><br><br><br>
<p>scaleX</p>
<div id="h6">Hello</div>
<p>scaleY</p>
<div id="h7">Web programming</div>
<p>skewX</p>
<div id="h8">Compiler Design</div>
<p>skewY</p>
<div id="h9">Cryptography</div>
</body>
</html>
Output:-
Page | 45
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-13
<head>
<script> function largest()
{ var num1, num2, num3;
num1 = Number(document.getElementById("N").value); num2 =
Number(document.getElementById("M").value); num3 =
Number(document.getElementById("O").value); if(num1>num2 &&
num1>num3)
{
document.getElementById('rst').innerText=num1+" is large";
}
else if(num2>num1 && num2>num3)
{
document.getElementById('rst').innerText=num2+" is large";
}
else if(num3>num1 && num3>num1)
{
document.getElementById('rst').innerText=num3+" is large";
}}
</script>
</head>
<body style="background-color:rgb(31, 67, 185); color:white;">
<p id="rst"></p>
<hr color="white">
<center><button onclick="largest()">OK</button>
</body>
</html>
Output:-
<head>
</head>
Page | 47
WEB DEVELOPMENT ER NO:211240116059
(315606)
<script>// This function will get value from user and pass it to Factorial function
function submit(){
{ var i;
var fact = 1;
{ fact = fact * i; }
return fact;
}
</script>
</body>
</html>
Page | 48
WEB DEVELOPMENT ER NO:211240116059
(315606)
Output:-
Page | 49
WEB DEVELOPMENT ER NO:211240116059
(315606)
} </script>
</head>
<body style="background-color:turquoise; color:black;">
<br>
<h1>No. is Palindrome or not</h1>
Enter No:<input type="text" name="n" id = "N"/>
<hr color="white">
<br>
<button onClick="Palindrome()">CHECK</button>
</body>
</html>
Output:-
Practical-14
Page | 50
WEB DEVELOPMENT ER NO:211240116059
(315606)
Aim: Create CD Catalogue Table in XML and display it using XSL Style Sheet.
<catalog>
<cd>
<title>Empire Burlesque</title>
<cd>
<country> UK </country>
<cd>
Page | 51
WEB DEVELOPMENT ER NO:211240116059
(315606)
<cd>
<country> UK </country>
<cd>
<country> EU </country>
<cd>
<country> UK </country>
</cd>
</catalog>
Page | 52
WEB DEVELOPMENT ER NO:211240116059
(315606)
<xsl:template match="/">
<html> <body>
<table border="1">
<th>Title</th>
<th>Artist</th>
<th>Country</th>
<th>Company</th>
<th>Price</th>
<th>Year</th>
</tr>
Page | 53
WEB DEVELOPMENT ER NO:211240116059
(315606)
</tr>
<tr>
<td><xsl:value-of select="title" />Greatest Hits</td>
<td><xsl:value-of select="artist" />Dolly Parton</td>
<td><xsl:value-of select="country" />USA</td>
<td><xsl:value-of select="company" />RCA</td>
<td><xsl:value-of select="price" />9.90</td>
<td><xsl:value-of select="year" />1982</td>
</tr>
<tr> <td><xsl:value-of select="title" />Still got the blues</td>
<td><xsl:value-of select="artist" />Gary Moore</td>
<td><xsl:value-of select="country" />UK</td>
<td><xsl:value-of select="company" />Virgin Records</td>
<td><xsl:value-of select="price" />10.20</td>
<td><xsl:value-of select="year" />1990</td>
</tr>
<tr>
<td><xsl:value-of select="title" />Eros</td>
<td><xsl:value-of select="artist" />Eros ramazzotti</td>
<td><xsl:value-of select="country" />EU</td>
<td><xsl:value-of select="company" />BMG</td>
<td><xsl:value-of select="price" />9.90</td>
<td><xsl:value-of select="year" />1997</td>
</tr>
<tr> <td><xsl:value-of select="title" />One night only</td>
<td><xsl:value-of select="artist" />Bees Gees</td>
<td><xsl:value-of select="country" />UK</td>
<td><xsl:value-of select="company" />Polydor</td>
Page | 54
WEB DEVELOPMENT ER NO:211240116059
(315606)
Output:-
Practical-15
Page | 55
WEB DEVELOPMENT ER NO:211240116059
(315606)
<head>
</head>
<body>
<p id="demo"></p>
document.getElementById("demo").innerHTML= myJSON;</script>
</body> </html>
Output:-
<html> <head>
</head>
<body>
<p id="demo"></p>
</body> </html>
Page | 56
WEB DEVELOPMENT ER NO:211240116059
(315606)
Output:-
<html>
<head>
</head> <body>
<p id="demo"></p>
//Storing data: myObj= { name: "NIRAV", age: 24, city: "VARODARA" }; myJSON=
JSON.stringify(myObj); localStorage.setItem("testJSON", myJSON); //Retrieving data: text =
localStorage.getItem("testJSON"); obj= JSON.parse(text);
document.getElementById("demo").innerHTML= obj.name;
Output:
Practical – 16
Page | 57
WEB DEVELOPMENT ER NO:211240116059
(315606)
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
type="text" name="dep"><br><br>
</form> </body>
} ?>
Output:
Page | 58
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-17
Aim : Write a PHP code for database connection with MySQL and also
perform insert and delete.
<?php
$servername="localhost";
$username="root";
$password="";
$conn=mysqli_connect($servername,$username,$password
mysqli_connect_error());
else{ echo "The db was not craeted successfully because of this error---
>".mysqli_error($conn);
} ?>
Output:
<?php
Page | 59
WEB DEVELOPMENT ER NO:211240116059
(315606)
$servername="localhost";
$username="root";
$password="";
$db="dbJay";
$conn=mysqli_connect($servername,$username,$passwo
mysqli_connect_error());
$result=mysqli_query($conn,$sql);
successfully. <br>";
} else{ echo "The Table was not craeted successfully because of this error---
>".mysqli_error($conn); }
?>
Output:-
Page | 60
WEB DEVELOPMENT ER NO:211240116059
(315606)
Practical-18
Aim: Write a program to connect to database.
HTML code
<?php
$servername = "localhost";
$username = "root";
$password = "";
$db = "practical";
?>
Output:
Page | 61
WEB DEVELOPMENT ER NO:211240116059
(315606)
Page | 62