selectuser.js
var xmlHttp;
function showUser(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getselect.jsp"
//alert(url=url+"?q="+str);
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
// JavaScript Document
index.jsp
<html>
<head>
<script src="selectuser.js"></script>
</head>
<body>
<center>
<form><br>
<br>
Select a ID: <select name="users"
onchange="return showUser(this.value);">
<option name=select>plz select</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></form>
<p>
<div id="txtHint"><b></b></div>
</center>
</body>
</html>
getselect.jsp
<link href="css/stylesheet.css" rel="stylesheet" type="text/css">
<% String email=request.getParameter("q");%>
<html>
<body >
<center>
<fieldset style="width:350px;" > <legend > EMPLOYEE DETAILS </legend>
<table width=320 border=0 cellspacing="1" cellpadding="0" >
<%int counter=1; %>
<%
if(email.equals("1")){%>
<tr class="headbgcolor" align="center"><td colspan="2" class="headtitle">EMPLOYEE DETAILS</td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>ID</b></td><td class="texttitle" >1</td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>NAME</b></td><td class="texttitle" >Himanshu</td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>DOB</b></td><td class="texttitle" >1897</td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>DOJ</b></td><td class="texttitle" >1987</td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>LOCATION</b></td><td class="texttitle" >odisha</td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>EMAIL</b></td><td class="texttitle" >swain.himansu@gmail.com</td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>MOBILE</b></td><td class="texttitle" >990909090</font></td></tr>
<tr class="bodybgcolor"><td class="texttitle" ><b>ADDRESS</b></td><td class="texttitle" >Odisha,India</td></tr>
<tr><td colspan=2><hr><b>END OF <%=counter%> TABLE</b><hr></td></tr>
<% counter++;}%>
</table>
</fieldset>
</font>
</center>
</body>
</html>
Subscribe to:
Post Comments (Atom)
How ChatGPT can Benefit Coding: Your Guide to Leveraging an AI Language Model
Introduction: Hello, coders! Welcome to this blog post on how ChatGPT, an AI language model, can benefit your coding skills and projects. A...
-
Scan.jsp <HTML> <HEAD> <title>Online Demo of Web Twain<...
-
index.jsp < HTML > < HEAD > < TITLE > Display file upload form to the user </ TITLE > </ HEAD > ...
-
It is a Fun Love calculator algorithm to find out love percentage. It is only for fun. You can check FLAMES Game . Here is Java...
No comments:
Post a Comment