CCS375 Web Technologies Lab Manual
CCS375 Web Technologies Lab Manual
COLLEGE OF ENGINEERING
AND TECHNOLOGY
TIRUPUR-641665
(AN ISO 9001:2015 CERTIFIED
INSTITUTION)
BONAFIDE CERTIFICATE
Register Number……………………………………………..
..……………………………………………………………………………………………………….........
Signature of Signature of
INDEX
1
S.N DATE EXPERIMENT TITTLE PAGE MAR SIG
O NO K N
1 IMAGE MAPPING IN
HTML
2 COLLEGE INFORMATION
SYSTEM USING STYLE SHEET
4 INSTALLATION OF APACHE
TOMCAT WEB SERVER
5 i. INVOKING SERVLETS
FROM HTML FORM
7 CREATION OF XML
DOCUMENT
8 a. FORM VALIDATION
USING PHP REGULAR
EXPRESSION
2
3
EX.NO:1
AIM:
To create a web page which includes a map and display the related
information when a hot spot is clicked in the map.
PROBLEM DESCRIPTION:
Image mapping:
An image map is an image with click able areas.
In image mapping an image is specified with certain set of coordinates
inside the image which act as hyperlink areas to different destinations.
Elements required:
The HTMLL<map>tag defines an image map.
Three basic html elements required for creating snapped image.
Map : Used to create map of the image with clickable areas
Img : Used to display image
Area: Used with in the map for defining clickable areas
PROCEDURE:
1
2
CODING:
Image map.html
<!DOCTYPEhtml>
<html>
<head>
<Title>Image Mapping</Title>
<h3><center>Mapping an Image</center></h3>
<body>
<p>Click on Continents to know about them</p>
<imgsrc="D:\world-map-151576_960_720.png"width="960"height=
"492" alt = "World Map"usemap = "#worldmap">
<mapname="worldmap">
<area shape="rect" coords="184, 36, 272, 158" alt="north
america" href="https://en.wikipedia.org/wiki/North_America">
<areashape="rect"coords="282,215,354,367"alt="southamerica"href="h
ttps://en.wikipedia.org/wiki/South_America">
<area shape="rect" coords="506, 151, 570, 333"
alt="africa" href="https://en.wikipedia.org/wiki/Africa">
<area shape="rect" coords="618, 42, 791, 162"
alt="asia" href="https://en.wikipedia.org/wiki/Asia">
<area shape="rect" coords="509, 44, 593, 110"
alt="europe" href="https://en.wikipedia.org/wiki/Europe">
<area shape="rect" coords="786, 288, 862, 341"
alt="australia"
href="https://en.wikipedia.org/wiki/Australia_(continent)">
<area shape="rect" coords="249, 463, 760, 488"
alt="antartica" href="https://en.wikipedia.org/wiki/Antarctica">
</map>
</body>
</html>
3
OUTPUT:
4
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
5
EX.NO:2
PROBLEM DESCRIPTION:
Web Page :
A web page is a document written in Hyper Text Markup Language
and can be viewed on any web browser.
A web page is a structured document that primarily consists of
hypertext, text with hyperlinks.
It is contained within the web server , the URL for that web page ,
and once it is loaded , it appears on the user’s web browser.
Elements required:
The<style>tag is used to define style information (CSS).
Inside the<style>element specify how HTML elements
shouldrenderin a browser.
CSScanbeaddedtoHTMLdocumentsin3ways:
Inline-by using the style attribute inside HTML elements.
Internal-by using a<style>element in the<head>section.
External-by using a<link>to link to an external CSS file.
PROCEDURE:
6
7
CODING:
index.html
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>2ndProgram</title>
<!--ExternalStyleSheet-->
<linkrel="stylesheet"href="./style.css">
<!--InternalStyleSheet-->
<style>
*{
padding:0px;
margin: 0px;
}
nav{
display:flex;
background - color: aqua;
justify-content : space -
between; padding: 5px;
}
.nav-items {
display: inline -
flex; height:3rem;
width:80px;
align-items: center;
justify-content:center;
border-radius: 10px;
}
</style>
</head>
8
<body>
<nav>
<!--InlineStyles-->
<divclass="nav-container"style="display:flex;align-items:center;">
<img src="./logo.png" alt="College logo"
style="height:3rem; margin-right : 10px;
width:4rem;margin-left: 1rem;">
<h2>JaiShriramEngineeringCollege</h2>
</div>
<divclass="nav-container">
<ul>
<li class="nav-items" style="background-color: wheat;
color: black"> Home</li>
<liclass="nav-items">Branch</li>
<liclass="nav-items">Course</li>
<liclass="nav-items">Profile</li>
</ul>
</div>
</nav>
<divid="body-content">
<div id="sidebar">
<buttonclass="side-items">StudentsList</button><br>
<buttonclass="side-items">Placement</button><br>
<buttonclass="side-items">CollegeProfile</button><br>
<buttonclass="side-items">Companies</button><br>
<button class="side-items">About Barani Hydraulics India Private
Limited</button>
</div>
<div id="content">
<h4>To provide value added education in engineering,
technology and management by elevating the student community with
state – of – the art infrastructure facilities, interactive teaching,
learning techniques and hands-on training through our own industry
support. Jai Shriram Engineering College was endowed by Shenthil
9
Velevan Trust in the year 2009 with a motto of equip ping and
implanting the seed of higher education
1
10
0
blended with communal harmony to the rural community in and around
the Textile City. JSREC reinforces to impart knowledge which are
innards of a meaningful life.</h4>
</div>
</div>
</body>
</html>
style.css
#body-content{
display:flex;
}
#sidebar {
padding:10px;
background-color:rgb(0,217,255);
height:88vh;
}
.side-items:hover{
background-color:rgb(0,255,255);
}
.side-items{
border-radius:10px;
height:4rem;
width:18rem;
background-color:transparent;
border: 1px solid white;
margin-top:3px;
font-size: 17px;
}
#content{ width:1
00%;
background-color:rgb(231,231,247);
display: flex;
1
11
1
align-items: center;
justify-content:center;
padding:50px;
text-
align:center;
font-size: 25px;
}
OUTPUT:
1
12
2
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
1
13
3
EX.NO
CLIENT-SIDE SCRIPTS FOR VALIDATING
WEB FORM CONTROLS USING
DHTML.
10
14
AIM:
PROBLEM DESCRIPTION:
Forms:
Forms are used on web pages for the user to enter their required
details that further send to the server for processing.
A form is also known as a web form or HTML form.
Java Script:
Java Script makes HTML pages more dynamic and interactive.
Java Script is a scripting language that enables you to create
dynamically updating content , control multimedia , animate
images, etc.
Java Script is a text – based programming language that can be used
both server-side and client-side in our net applications.
JavaScript is used for developing web pages with more interactive
and user-friendly.
Elements required:
<form>
<script>
<label>
<input>
<div>
<style>
10
15
PROCEDURE:
1. Static web pages of an online Book store is developed with
following pages.
Homepage
Registration and user Login
User profile page
Books catalogue
Payment by credit card
2. Each input box in web page is validated using java script code using
<script>tag in html file.
3. Designed output is displayed.
CODING:
<html>
<head>
<title>A Simple Form with Java Script Validation</title>
<scripttype="text/javascript">
<!--
functionvalidate_form()
{
valid=true;
if(document.contact_form.contact_name.value=="")
{
alert("Pleasefillinthe'YourName'box.");
valid = false;
}
if(document.contact_form.contact_name.value!="")
{
alert("Succesfull");
valid = false;
}
returnvalid;
}
//-->
</script>
</head>
<bodybgcolor="#FFFFFF">
<formname="contact_form"method="post"onSubmit="return
validate_form ( );">
PleaseEnterYour Name
<p>YourName:<inputtype="text"name="contact_name"></p>
<p><inputtype="submit"name="send"value="SendDetails"></p>
</form>
11
1
</body>
</html>
OUTPUT:
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
12
2
13
3
EX.NO:4
AIM:
PROBLEM DESCRIPTION:
Apache Tomcat:
Apache Tomcat is an open-source web server and servlet container
for Java code.
Tomcat executes programs written in the Java programming
language, and it implements many Java EE specifications, including
Jakarta Servlet, Jakarta Server Pages, and others.
Prerequisites:
Java JRE installed and configured
Administrator privileges
PROCEDURE:
14
4
15
5
Step2:Install Tomcat
16
6
Install Tomcat via the Windows Service Installer for an automated
and wizard-guided experience.
The service installer installs the Tomcat service and runs it automatically
when the system boots.
For aportable experience , install Tomcat using the zipfile and avoid
installing the service.
Easily uninstall Tomcat when it is no longer needed by deleting the
Tomcat directory, or move it around when necessary.
17
7
4. In the Tomcat component selection screen , choose Full in the
dropdown menu to ensure the wizard installs the Tomcat Host Manager
and Servlet and JSP examples web applications.
Alternatively , keep the default Normal installation type and click Next.
5. Then ext step configures the Tomcat server . For instance , enter
the Administrator login credentials or choose a different
connection port . When finished , click Next to proceed to the next
step.
18
8
6. The next step requires you to enter the full path to the JRE directory
on your system. The wizard auto-completes this if you have previously
set upthe Java environment variables.
Click Next to proceed to the next step.
7. Choose the Tomcat server install location or keep the default one
and click Install.
19
9
8. Check the Run Apache Tomcat box to start the service after
the installation finishes.
Optionally , check the Show Readme box to seethe Read me file.To
complete the installation, click Finish.
11
10
0
9. A popup window appears that starts the Tomcat service. After the
process completes , the window closes automatically . The Apache
Tomcat web server is now successfully installed
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
11
11
1
EX.NO:5
(i)INVOKING SERVLETS FROM HTML
DATE:
FORM
AIM:
PROBLEM DESCRIPTION:
Java:
Java is a widely used programming language for coding
web applications.
Java is a multi – platform , object oriented and network centric
language that can be used as a platform in itself.
Servlet:
Servlet is an application that is running on a server.
Servlet is a Java programming language class that is used to extend
the capabilities of servers that host applications accessed by means
of a request-response programming model.
There are two main types of servlets as Generic and HTTP servlet.
Elements required:
<form>
<script>
<label>
<input>
<div>
<style>
PROCEDURE:
client.html
1. Create a web page using HTML form that contains the fields such
as text, password and one submit button.
2. Set the URL of the server as the value of form’s action attribute.
3. Run the HTML program.
20
12
20
13
4.Submit the form data to the server.
server.java:
1. Define the class server that extends the property of the class Http
Servlet
2. Handle the request from the client by using the method service()
of Http Servlet class.
3. Get the parameter names from the HTML form by using the
method get Parameter Names().
4. Get the parameter values from the HTML forms by using the
method getParameter().
5. Send the response to the client by using the method of Print Writer
class.
CODING:
MySrv.java:
importjava.io.IOException;
import java.io.PrintWriter;
importjavax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
public class MySrv extends HttpServlet {
publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriterout=response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\">");
out.println("<HTML>");
out.println("<HEAD><TITLE>AServlet</TITLE></
HEAD>"); out.println(" <BODY>");
//GettingHTMLparametersfromServlet
Stringusername=request.getParameter("uname")
; String password=request.getParameter("pwd");
if((username.equals("user"))&&(password.equals("pswd")))
{
out.println("<h1>Welcometo"+username);
}
else
21
1
{
out.println("<h1>Registrationsuccess");
out.println("<ahref='./index.html'>ClickforHomepage</a>");
}
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)
throws ServletException, IOException {
doPost( request,response);
}
}
Registration.html:
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.0Transitional//EN">
<HTML><HEAD>
<TITLE>NewDocument</TITLE>
<METANAME="Generator" CONTENT="EditPlus">
<METANAME="Author" CONTENT="">
<METANAME="Keywords" CONTENT="">
<METANAME="Description" CONTENT="">
</HEAD>
<BODYbgcolor='#e600e6'>
<formaction='./MySrv'method="post"><center><h1><u>LoginPage</u></h1>
<h2>Username:<inputtype="text"name="uname"/>
Password : <input type="password" name="pwd"/>
<inputtype="submit"value="clickme"/>
</center>
</form>
</body>
</HTML>
web.xml:
<web-app>
<servlet>
<servlet-name>MySrv</servlet-name>
22
2
<servlet-class>MySrv</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MySrv</servlet-name>
<url-pattern>/MySrv</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
OUTPUT:
23
3
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
24
4
EX.NO:5
(ii) SESSION TRACKING USING HIDDEN
DATE:
FORM FIELDS
AIM:
PROBLEM DESCRIPTION:
Java:
Java is a widely used programming language for coding
web applications.
Java is a multi – platform , object oriented and network centric
language that can be used as a platform in itself.
Servlet:
Servlet is an application that is running on a server.
Servlet is a Java programming language class that is used to extend
the capabilities of servers that host applications accessed by means
of a request-response programming model.
There are two main types of servlets as Generic and HTTP servlet.
SessionID:
A session ID is a unique identification string usually a long, random
and alpha – numeric string , that is transmitted between the client
and the server.
Session IDs are usually stored in the cookies , URLs (in case
url rewriting) and hidden fields of Web pages.
Common mechanisms used for session tracking are
Cookies , SSL sessions , URL- rewriting
Elements required:
<form>
<script>
25
5
<label>
<input>
<div>
<style>
PROCEDURE:
1. Create a web page using HTML form that contains the fields such
as text, password and one submit button.
2. Set the URL of the server as the value of form’s action attribute.
3. A skif the user wants to add more items or checkout.
4. Include the current items as hidden fields so they 'll be passed on
and submit to self.
CODING:
register.html:
<html>
<bodybgcolor="cyan">
<center>
<h1>WELCOMETOREGISTRATIONPAGE</h1>
<form action="./registerone" METHOD="post">
Name:<inputtype="text"name="name"><br><br
>
Password:<inputtype="password"name="password"><br><br>PROFESS
ION:
<selectname="profession">
<optionvalue="engineer">ENGINEER</option>
<optionvalue="teacher">TEACHER</option>
<optionvalue="businessman">BUSINESSMAN</option>
</select><br><br>
<inputtype="submit"value="REGISTER">
</form>
</center>
</body>
</html>
web.xml
<web-app>
26
6
<welcome-file-list>
27
7
<welcome-file>register.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>RegistrationServletOne</servlet-name>
<servlet-class>RegistrationServletOne</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegistrationServletOne</servlet-name>
<url-pattern>/registerone</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>RegistrationServletTwo</servlet-name>
<servlet-class>RegistrationServletTwo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegistrationServletTwo</servlet-name>
<url-pattern>/registertwo</url-pattern>
</servlet-mapping>
</web-app>
Registration Servlet
Two.java
import java.io.IOException;
import java.io.PrintWriter;
importjavax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
publicclassRegistrationServletTwoextendsHttpServlet
{
29
9
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throwsServletException,IOException
{
Stringname=request.getParameter("name");
String password = request.getParameter("password");
Stringprofession=request.getParameter("profession");
String email = request.getParameter("email");
String cell = request.getParameter("cell");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><bodybgcolor=wheat>");
out.println("<center>");
out.println("<h1>REGISTRATIONSUCCESSFUL...............</h1>");
out.println("</center>");
out.println("</body></html>");
out.close();
}
OUTPUT:
21
10
0
21
11
1
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
21
12
2
EX.NO:6
ON-LINE EXAMINATION USING JSP
DATE:
AIM:
PROBLEM DESCRIPTION:
Java:
Java is a widely used programming language for coding
web applications.
Java is a multi – platform , object oriented and network centric
language that can be used as a platform in itself.
JSP
It stands forJavaServerPages.
It is a server-side technology.
It is used for creating web application.
It is used to create dynamic web content.
In this JSP tags are used to insert JAVA code into HTML pages.
It is an advanced version of Servlet Technology.
It is a Web based technology helps us to create dynamic and
platform-independent web pages.
In this , Java code can be inserted in HTML/XML pages or both.
JSP is first converted into servlet by JSP container
before processing the client’s request.
PROCEDURE:
Steps for Creating Data Source for Microsoft Access drivers
1.Goto Control Panel and Select Administrative Tools and then select
Data Source ODBC icon. (or)
30
13
30
14
Goto Run (Press Window + R) and type odbcad 32 . exetogo DataSource
ODBC.
2. Press Add Button.
3. Choose the driver for Microsoft
Access. 4.Then, Press Finish Button.
5. Type Data Source Name as Exam Student.
6. Then Press "Select Button" and choose the database file which is
created already.
7. Then , Press "OK" Button to complete the process.
DataTypeSeat_no
Number
Name Text
Marks Number
CODING:
//OnlineExam.jsp
<%@pagelanguage="java"import="java.sql.*"%>
<%@pageimport="java.io.*"%>
<%@pageimport="java.util.*"%>
<%
StringSeatNum,Name;
Stringans1,ans2,ans3,ans4,ans5;
int a1,a2,a3,a4,a5;
31
1
a1=a2=a3=a4=a5=0;
32
2
Connectionconnect=null;
Statement stmt=null;
ResultSetrs=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:ExamStudent";
connect=DriverManager.getConnection(url,"","");
if(request.getParameter("action")!=null)
{
SeatNum=request.getParameter("Seat_no");
Name = request.getParameter("Name");
ans1=request.getParameter("group1
"); if(ans1.equals("True"))
a1=5;
else
a1=0;
ans2=request.getParameter("group2");
if(ans2.equals("True"))
a2=0;
else
a2=5;
ans3=request.getParameter("group3");
if(ans3.equals("True"))
a3=0;
else
a3=5;
ans4=request.getParameter("group4");
if(ans4.equals("True"))
a4=5;
else
a4=0;
ans5=request.getParameter("group5");
if(ans5.equals("True"))
a5=0;
33
3
else
a5=5;
intTotal=a1+a2+a3+a4+a5;
stmt=connect.createStatement();
Stringquery="INSERTINTOStudentTable("+"Seat_no,Name,Marks"+")
VALUES ('" +SeatNum + "', '" + Name + "', '"+Total+ "')";
intresult=stmt.executeUpdate(query);
stmt.close();
stmt=connect.createStatement();
query="SELECT*FROMStudentTableWHEREName="+"'"+Name+"'";
rs = stmt.executeQuery(query);
%>
<html><head><title>StudentMarkList</title></head>
<bodybgcolor=khaki>
<center>
StudentsMarksheet
NameoftheCollege:JAISHRIRAMENGINEERINGCOLLEGE
<tableborder="1"cellspacing="0"cellpadding="0">
<tr>
<td><b>Seat_No</b></td>
<td><b>Name</b></td>
<td><b>Marks</b></td>
</tr>
<%
while(rs.next())
{
%>
<tr>
<td><%=rs.getInt(1)%></td>
<td><%=rs.getString(2)%></td>
<td><%=rs.getString(3)%></td>
</tr>
34
4
<%
}
rs.close();
stmt.close();
connect.close();
%>
</table>
</center>
<br/><br/><br/>
<table>
<tr><td><b>Date:<%=newjava.util.Date().toString()%></td></tr>
<tr><td><b>Signature:X.Y.Z.<b></td></tr>
</table>
<div>
Clickheretogoback
</body>
</html>
<%}else{%>
<html>
<head><title>OnlineExamination</title>
<scriptlanguage="javascript"
>
functionvalidation(Form_obj)
{
if(Form_obj.Seat_no.value.length==0)
{
alert("Please,filluptheSeatNumber");
Form_obj.Seat_no.focus();
returnfalse;
}
if(Form_obj.Name.value.length==0)
{
alert("Please,filluptheName");
35
5
Form_obj.Name.focus();
36
6
returnfalse;
}
returntrue;
}
</script>
</head>
<bodybgcolor=lightgreen>
<center>
OnlineExamination
</center>
<form action="OnlineExam.jsp" method="post"
name="entry"onSubmit="returnvalidation(this)">
<inputtype="hidden"value="list"name="action">
<hr/>
<table>
<tr>
<td>
SeatNumber:</td>
<td><inputtype="text"name="Seat_no"></td>
</tr>
<tr>
<td>
Name:</td>
<td><inputtype="text"name="Name"size="50"></td>
</tr>
<tr>
<td><b>TotalMarks:5*5=25</b></td>
<td></td><td></td><td></td><td><b>Time:15Min.</b></td>
</tr>
</table>
<hr/>
<b>1.XMLenablesyoutocollectinformationonceandreuseitina variety
of ways.</b><br/>
37
7
<inputtype="radio"name="group1"value="True">True
<inputtype="radio"name="group1"value="False">False<br>
<br/>
<b>2.InModernPCthereisnocache memory.</b><br/>
<inputtype="radio"name="group2"value="True">True
<inputtype="radio"name="group2"value="False">False<br>
<br/>
<b>3.JavaScriptfunctionscannotbeusedtocreatescriptfragments that
can be used over and over again</b><br/>
<inputtype="radio"name="group3"value="True">True
<inputtype="radio"name="group3"value="False">False<br>
<br/>
<b>4.TheDriverManagerclassisusedtoopenaconnectiontoa database
via
aJDBC driver.</b><br/>
<inputtype="radio"name="group4"value="True">True
<inputtype="radio"name="group4"value="False">False<br>
<br/>
<b>5.TheJDBCandODBCdoesnotshareacommonparent</b><br/>
<inputtype="radio"name="group5"value="True">True
<inputtype="radio"name="group5"value="False">False<br>
<hr/>
<center>
<inputtype="submit"value="Submit">
<inputtype="reset"value="Clear"><br><br>
</center>
</form>
<%}%>
38
8
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
39
9
Ex.No.7
PROBLEM DESCRIPTION:
XML:
XML is a meta-markup language that provides a format for
describing structured data.
This facilitates more structured declarations of content and more
meaningful search result across multiple platforms.
The start of XML markup elements is identified by either the
lessthan symbol (), the apostrophe or single quote (‘) and the
double quotation marks (“) are used by XML for markup.
To use these special characters as content within your document,
you must use the corresponding general XML entity.
Elements required:
<form>
<script>
<label>
<input>
<div>
<style>
PROCEDURE:
1. SaveStudentsinformationintheXMLfileonthespecificlocation.
2. CreateandestablishtheserverconnectionbetweenhtmlfileandXML file
in the host
31
10
0
31
11
1
3. Get the user ID as input
4. Display the user’s information.
CODING:
index.html
<!DOCTYPEhtml>
<HTML>
<HEAD><TITLE>SearchingforXMLElements</TITLE>
<SCRIPT>
functionreadXMLData()
{
varxmlDocumentObject, id , name , addr, phone, email;
xmlDocumentObject=new XMLHttpRequest();
xmlDocumentObject.open("GET","userlist.xml",false);
xmlDocumentObject.send();
xmlDocumentObject=xmlDocumentObject.responseXML;i
d=xmlDocumentObject.getElementsByTagName("userid"
);
name=xmlDocumentObject.getElementsByTagName("username")
;
address=xmlDocumentObject.getElementsByTagName("address")
; phone = xmlDocumentObject.getElementsByTagName("phone");
email = xmlDocumentObject.getElementsByTagName("email");
for(i=0;i<id.length;i++)
{
output=id[i].firstChild.nodeValue;
if(output==document.getElementById("myText").value)
{displayDIV.innerHTML = id[i].firstChild.nodeValue + "<br> "
+ name[i].firstChild.nodeValue
+"<br> " +address[i].firstChild.nodeValue + "<br> " +
phone[i].firstChild.nodeValue+"<br>"+email[i].firstChild.nodeValue;
} }}
</SCRIPT></HEAD>
<BODY>
31
12
2
<H1>SearchUser</H1>
<inputtype="text"id="myText"value="">
31
13
3
<input type="BUTTON" VALUE="Get User
Details" ONCLICK="readXMLData()">
<P>
<DIVID="displayDIV"></DIV>
</BODY>
</HTML>
User list.xml:
<userlist>
<userid>usr01</userid>
<username>Abi</username>
<address>Kovai</address>
<phone>9000067078</phone>
<email>[email protected]</email>
<userid>usr02</userid>
<username>Priya</username>
<address>Tiruppur</address>
<phone>9234567890</phone>
<email>[email protected]</email>
<userid>usr03</userid>
<username>sadhana</username>
<address>Avinashi</address>
<phone>9245228888</phone>
<email>[email protected]</email>
<userid>usr04</userid>
<username>Nasrin</username>
<address>Dindugal</address>
<phone>8877665543</phone>
<email>[email protected]</email>
<userid>usr05</userid>
<username>praveena</username>
<address>Perambalur</address>
<phone>8675432109</phone>
<email>[email protected]</email>
14
40
</userlist>
OUTPUT:
41
1
Performance 20
Program 40
Result 20
Record 20
Total 100
RESULT:
42
2
43
3
44
4
45
5
46
6
47
7
68
8