Very urgent Image Selection

Very urgent Image Selection

View Answers

August 13, 2008 at 4:46 PM

Hi friend,

Your Problem in stateChanged() function opening "{" and closing braces "}" are not equal
No of opening braces "{" are 5 and closing braces "}" are 3

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var showdata = xmlHttp.responseText;
var strar = trim(showdata).split(":");
if(strar.length>0)
{
for(var i=1;i<=imgs.length;i++) {
if(imgid==img_id){
opener.document.getElementById("emp_id").value=strar[1];
opener.document.getElementById("emp_name").value=strar[0];
window.close();
}
}
}
-------------------------------

August 13, 2008 at 4:47 PM

<%@ page language="java" import="java.sql.*" %>
<html>
<head>
<script type="text/javascript">
var imageURL = "redar.jpg";
function changeImage(img_id) {

var imgs=document.getElementsByTagName('img');
for(var i=1;i<=imgs.length;i++) {
var imgid="myImage"+i;
if(imgid==img_id){
document.getElementById(img_id).src="greenar.gif";
}
else{
document.getElementById(imgid).src=imageURL;
}
}


}

function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function validate()
{
var emp_value ="";
var count=0;
var imgs=document.getElementsByTagName('img');
for(var i=1;i<=imgs.length;i++) {
var imgid="myImage"+i;
var imgurl = document.getElementById(imgid).src;
var imgar = imgurl.split("/");
if(imgar[3]=="greenar.gif")
{
count++;
}
}
if(count==0)
{
alert("Please Select Employee Id");
return false;
}
return true;
}
function showEmp()
{
if(validate()){
var imgs=document.getElementsByTagName('img');
for(var i=1;i<=imgs.length;i++) {
var imgid="myImage"+i;
var emp_id = "eid"+i;
var imgurl = document.getElementById(imgid).src;
var imgar = imgurl.split("/");
if(imgar[3]=="greenar.gif")
{
var emp_value = document.getElementById(emp_id).value;
}
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null){
alert ("Browser does not support HTTP Request")
return
}
var url="getuser.jsp";
url=url+"?emp_id="+emp_value;
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
}

function stateChanged(){
if (xmlHttp.readyState==4){
var showdata = xmlHttp.responseText;
var strar = trim(showdata).split(":");
if(strar.length>0){
for(var i=1;i<=imgs.length;i++) {
if(imgid==img_id){
opener.document.getElementById("emp_id").value=strar[1];
opener.document.getElementById("emp_name").value=strar[0];

window.close();
}
}
}
}
}

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;

}
</script>
</head>

August 13, 2008 at 4:48 PM

<body>
<form name="employee">
<br><br>
<table border="1" width="400px" align="center" bgcolor="#CDFFFF">
<tr><td align="center" colspan=2><b>Select Employee Id</b></td></tr>
<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar" ;
String password="amar123";
int sumcount=0;
Statement st;
try {
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
String query = "select * from Employee";
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
%>
<%
int count=0;
while(rs.next())
{
count++;
%>
<tr><td align="center" width="50%">
<input type="hidden" value="<%=rs.getString(1)%>" id="eid<%=count%>">
<img src="redar.jpg" width="25px" height="25px" name="myImage" onclick="changeImage(this.id);" id="myImage<%=count%>" border="0">
<%=rs.getString(2)%></td>
<td width="50%"><%=rs.getString(3)%></td></tr>
<%
}
}
catch (Exception e) {
e.printStackTrace();
}
%>
<tr><td align="center" width="50%"><input type="button" value="Select" onclick="javascript:showEmp('Rose');"></td></tr>
</table>
</form>
</body>
</html>

Thanks

amar









Related Tutorials/Questions & Answers:
Very urgent Image Selection - JSP-Servlet
Very urgent Image Selection  Respected Sir/Madam, I am R.Ragavendran.. If you are telling that your coding works fine, then can u plz tell me or send me the output of the following code asap? var imageURL
Image selection instead of radio button very urgent.. - JSP-Servlet
Image selection instead of radio button very urgent..  Respected Sir/Madam, I am R.Ragavendran.. Actually in the following using radio... successfully. But I need some icon or some pictorial selection instead
Advertisements
Very Very Urgent -Image - JSP-Servlet
Very Very Urgent -Image  Respected Sir/Madam, I am... opened which comprises of Emp ID's present inside the database along with Image button for each row.. When I click the image Button, the color of the image
Image Selection Reply Urgent.. - JSP-Servlet
Image Selection Reply Urgent..  Respected Sir/Madam, I am R.Ragavendran.. Thanks for yuor fast response.. Sir actually I will be much more... am very new to it.. Here's the code: function trim(stringToTrim
Syntax for image selection Urgent - JSP-Servlet
Syntax for image selection Urgent  Respected Sir/Madam, I am using the following syntax to know whether radio button has been clicked or not: for(var i=0;i  Hi friend, now show the question no 2129 Here
very urgent
very urgent  ** how to integrate struts1.3 ,ejb3,mysql5.0 in jboss server with myeclipse IDE
image selection
image selection  hi my issue is : I have select dropdown list when I selected image it displays some default color having image I change the color... it redirect to error image page. can you tell how to solve this problem and where
Pop up Very Very Urgent - JSP-Servlet
='' Its Very Urgent.. Please send me the coding asap.. Thanks...Pop up Very Very Urgent  Respected Sir/Madam, I am R.Ragavendran.. I got your reply.. Thank you very much for the response. Now I am sending
Help Very Very Urgent - JSP-Servlet
requirements.. Please please Its Very very very very very urgent... Thanks...Help Very Very Urgent  Respected Sir/Madam, I am sorry..Actually the link u have sent was not my actual requirement.. So,I send my requirement
Program Very Urgent.. - JSP-Servlet
Program Very Urgent..  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your superb reply. I got the link you sent. But I find a simple problem... its most urgent.. Thanks/Regards, R.Ragavendran..   Hi friend
JSP and AJAX- very urgent - Ajax
Plz its very very Urgent.. Regards, Ragavendran...JSP and AJAX- very urgent  Respected Sir/Madam, I am Ragavendran.. I have a simple doubt.. At present, I am in a module of the project
Image Selection - Swing AWT
Image Selection  Hi, I need to provide the image selection facility...; JButton saveButton; public DisplayImage() { super("Image Selection program... click on any item, the image of that item should be selected as done in windows
JSP and AJAX very urgent - Ajax
JSP and AJAX very urgent  Hi Team, This is Ragavendran.R.. I have a very basic doubt in AJAX. While Using AJAX, of course, there will be tag involved in JSP page. But in my current project, I am using too many tags
its very urgent please help me
its very urgent please help me  how can i retrieve all images from ms access database and display in jsp pages
Ple help me its very urgent
Ple help me its very urgent  Hi.. I have one string 1)'2,3,4' i want do like this '2','3','4' ple help me very urgent
Program Arrow selection Most Urgent - JSP-Servlet
Program Arrow selection Most Urgent  Respected Sir/Madam, I am R.Ragavendran.. I got your coding which is highly appreciable.. As per my requiremennt,there are image buttons for each row in the database.. But i am
very urgent, want to submit my project on monday
very urgent, want to submit my project on monday  i have the code for connected combo-boxes(jsp). But the thing i want to know is, how to access the values selected in those combo-boxes, for storing in database. in the case
very urgent - Java Server Faces Questions
check it once and give me a correct solution. It is very urgent for me. Thanks...very urgent  Hi sir, yesterday i send total my code to find where i have done mistake ,you send a reply for that also but in that you told remove
Basic problem but very urgent - JSP-Servlet
Basic problem but very urgent  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your superb reply. I got the link you sent. But I find a simple... me the cause of the problem asap because its most urgent.. Thanks/Regards
very urgent - Java Server Faces Questions
very urgent  Hi sir, see my code and please tell me mistake. it is very urgent for me. here is my code: addmin.jsp: Users... [email protected] 8888 deepak kumar It is very urgent for me please give
Programming help Very Urgent - JSP-Servlet
Please please its very urgent.. Thanks/Regards, R.Ragavendran..  ...Programming help Very Urgent  Respected Sir/Madam, Actually my code shows the following output: There is a combo box which contains all the ID's
Popup very urgent plz - JSP-Servlet
Popup very urgent plz  Respected Sir/Madam, I am R.Ragavendran.. I got your reply.. Thank you very much for the response. Now I am sending the code...='' Its Very Urgent.. Please send me the coding asap.. Thanks/Regards
&nbsp;(very urgent) - Java Server Faces Questions
 (very urgent)  hi friends, This is my code in JSF                    
&nbsp;(very urgent) - Design concepts & design patterns
 (very urgent)  hi friends, This is my code in html                   
JSP,JDBC and HTML(Very Urgent) - JSP-Servlet
JSP,JDBC and HTML(Very Urgent)  Respected Sir/Madam, Thanks... exact requirement in which if I get an immediate help,I will be very much grateful to ROSEINDIA team.. This is Very Urgent. Plz Plz send me the coding ASAP
Radio Buttons in DB Very Urgent - JSP-Servlet
Very Urgent.. Please send...Radio Buttons in DB Very Urgent  Respected Sir/Madam, I am R.Ragavendran.. I got your reply.. Thank you very much for the response. Now I am sending
Validating Number Very Urgent - JSP-Servlet
Validating Number Very Urgent  Respected Sir/Madam, I am...('id').value= document.getElementById('name').value='' Its Very Urgent.. Please send me the coding asap.. Thanks/Regards, R.Ragavendran.. 
Simple Program Very Urgent.. - JSP-Servlet
Simple Program Very Urgent..  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your superb reply. I find a simple problem which i have tried my... coding asap because its most urgent.. Thanks/Regards, R.Ragavendran..  
Please help me... its very urgent
Please help me... its very urgent  Please send me a java code to check whether INNODB is installed in mysql... If it is there, then we need to calculate the number of disks used by mysql
very urgent - Design concepts & design patterns
very urgent  Hi friends, I have a page layout with a menu on the left, the menu looks perfect in my personal system but the spacing and the rollover effect is all messed up in server system. How can i fix this : I only have
plz help -java project very urgent
plz help -java project very urgent  ? Ford furniture is a local furniture store in acts, and they as CS graduate students to implement a software system to generate various reports for them at the end of each month. You
Simple problem Very Urgent - JSP-Servlet
Simple problem Very Urgent  Respected SDir/Madam, I am R.ragavendran.. Thanks for your superb reply. I got the coding. But I find a simple problem which i hava tried my level best to solve. A pop up window is opening
Image Program Urgent - JSP-Servlet
Image Program Urgent  Respected Sir/Madam, I am R.Ragavendran.. Actuaaly in the Image Selection coding which is produced below, I am getting the Emp ID in the Emp ID text box but not the exact Emp ID which I have selected
Image problem Urgent - JSP-Servlet
Image problem Urgent  Respected Sir/madam, I am R.Ragavendran.. Actually I got your coding.. But This code is not enabling the user to click and change the image.. I request you to remember the code which you have
very urgent : Iam unable to code this program plz help me - RMI
very urgent : Iam unable to code this program plz help me  Write a Multi-user chat server and client.  Hi friend, Chat server is a standlone application that is made up the combination of two-application, server
I am getting Undefined in Text Box Very Urgent - JSP-Servlet
I am getting Undefined in Text Box Very Urgent  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your superb reply. I got the coding. But I find a simple problem which i hava tried my level best to solve. A pop up window
Urgent
J2ME programming  Hi, J2ME programming - How to learn J2ME Programming very fast? Thank You
Selection Sort in Java
Selection sort in Java is used to sort the unsorted values in an array. In selection sorting algorithm, the minimum value in an array is swapped to the very first position in that array. In the next step the first value of array
highlight uitableviewcell on selection
the UITableViewCell on selection in my application.   UITableViewCell... highlight it or use the default selection for the cell in UITableView. Also you can disable the the stye by setting StyleNone to cell selection. But in case
urgent need
urgent need   Input a line. Count the number of words that start with a capital letter
Selection based on other selection in jsp
Selection based on other selection in jsp  I am trying to create a jsp page. Where I am having a select list containing category name and for each... selection on same jsp page such that when someone select a category only the products
Urgent requirement
Urgent requirement  I want to implement Autocompletion code for Jcombobox in swing can you please help me out from
image
image  how to add the image in servlet code
changing selection color of <button>
changing selection color of   dear all, i have loaded image in border less button tag when button is selected with tab key i get brown color rectangle around image. how do i change color of that rectangle from brown to white
insert multiple selection - Java
insert multiple selection - Java  how to insert multiple selection values from html into database using servlets
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
ModuleNotFoundError: No module named 'selection'
ModuleNotFoundError: No module named 'selection'  Hi, My Python... 'selection' How to remove the ModuleNotFoundError: No module named 'selection' error? Thanks   Hi, In your python environment you
image
image   Dear every body please help me how to add and retrive image and video into oracle 11g using jsp

Ads