Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

Fresher Job


Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
[email protected]


Java Server Pages


Java Beans



Java Servlets



Java Code Examples

Interview Questions

Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting


Beginner Guide to Linux Server


Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers


Adware & Spyware Remover

Open Source Softwares

hai......<br />sure dude...<br />it hink there are two problems with this image selection....<br />1. Can you pass the value of the selected image on submition?<br />2. Is there any way to avoid multiple selection of the image?i mean make it like a radio button...<br /><br />if u can solve this, then this image selection would not be a problem....
Hi friend,<br /><br />i am sending running program. <br /><br />&lt;%@ page import=&quot;java.sql.*&quot; %&gt; <br /><br />&lt;html&gt;<br /><br />&lt;head&gt;<br /><br />&lt;script type=&quot;text/javascript&quot;&gt;<br /><br /><br /><br />///// Code chages <br /><br />var imageURL = &quot;redar.jpg&quot;;<br /><br /><br /><br /><br /><br /><br /><br />function changeImage(img_id) {<br /><br /> <br /><br /> <br /><br />var imgs=document.getElementsByTagName('img'); <br /><br /> for(var i=1;i&lt;=imgs.length;i++) { <br /><br /> var imgid=&quot;myImage&quot;+i;<br /><br /> if(imgid==img_id){<br /> document.getElementById(img_id).src=&quot;greenar.gif&quot;;<br /><br /> }<br /><br /> else{<br /><br /> document.getElementById(imgid).src=imageURL;<br /><br /> } <br /><br /> } <br /><br />}<br /><br /><br /><br />///////////////<br /><br /><br /><br /><br /><br />function trim(stringToTrim) {<br /><br /> return stringToTrim.replace(/^\s+|\s+$/g,&quot;&quot;);<br /><br />}<br /><br /><br /><br />function validate()<br /><br />{<br /><br /> ///// code chages ////<br /><br /> var emp_value =&quot;&quot;;<br /><br /> var count=0;<br /><br /> var imgs=document.getElementsByTagName('img'); <br /><br /> for(var i=1;i&lt;=imgs.length;i++) {<br /><br /><br /><br /> var imgid=&quot;myImage&quot;+i;<br /><br /> <br /><br /> var imgurl = document.getElementById(imgid).src;<br /><br /> var imgar = imgurl.split(&quot;/&quot;);<br /><br /> if(imgar[3]==&quot;greenar.gif&quot;)<br /><br /> {<br /><br /> count++;<br /><br /> }<br /><br /><br /><br /> //////////////////////<br /><br /> <br /><br /> }<br /><br /><br /><br /> if(count==0)<br /><br /> {<br /><br /> alert(&quot;Please Select Employee Id&quot;);<br /><br /> return false;<br /><br /> }<br /><br /> return true;<br /><br />}<br /><br /><br /><br /><br /><br />function showEmp()<br /><br />{ <br /><br /> <br /><br /> ///// code changes /////<br /><br /> if(validate()){<br /><br /> var imgs=document.getElementsByTagName('img'); <br /><br /> for(var i=1;i&lt;=imgs.length;i++) {<br /><br /><br /><br /> var imgid=&quot;myImage&quot;+i;<br /><br /> var emp_id = &quot;eid&quot;+i;<br /><br /> var imgurl = document.getElementById(imgid).src;<br /><br /> var imgar = imgurl.split(&quot;/&quot;);<br /><br /> if(imgar[3]==&quot;greenar.gif&quot;)<br /><br /> {<br /><br /> var emp_value = document.getElementById(emp_id).value;<br /><br /> }<br /><br /> <br /><br /> }<br /><br /><br /><br /> ///////////
xmlHttp=GetXmlHttpObject();<br /><br /> if (xmlHttp==null)<br /><br /> {<br /><br /> alert (&quot;Browser does not support HTTP Request&quot;)<br /><br /> return<br /><br /> }<br /><br />var url=&quot;getuser.jsp&quot;<br /><br />url=url+&quot;?emp_id=&quot;+emp_value;<br /><br /><br /><br />xmlHttp.onreadystatechange=stateChanged <br /><br /> xmlHttp.open(&quot;GET&quot;,url,true)<br /><br />xmlHttp.send(null)<br /><br /> }<br /><br /><br /><br /> <br /><br />}<br /><br /><br /><br />function stateChanged() <br /><br />{ <br /><br /> <br /><br /> <br /><br />if (xmlHttp.readyState==4 || xmlHttp.readyState==&quot;complete&quot;)<br /><br /> { <br /><br /> <br /><br /> var showdata = xmlHttp.responseText;<br /><br /> // alert(showdata);<br /><br /> var strar = trim(showdata).split(&quot;:&quot;);<br /><br /> <br /><br /> if(strar.length&gt;0)<br /><br /> {<br /><br /> window.opener.location.reload();<br /><br /> window.location.reload(); <br /><br /> window.close(); <br /><br /> opener.document.getElementById(&quot;emp_id&quot;).value=strar[1];<br /><br /> opener.document.getElementById(&quot;emp_name&quot;).value=strar[0];<br /><br /> window.close();<br /><br /> }<br /><br /> } <br /><br />}<br /><br /><br /><br />function GetXmlHttpObject()<br /><br />{<br /><br />var xmlHttp=null;<br /><br />try<br /><br /> {<br /><br /> // Firefox, Opera 8.0+, Safari<br /><br /> xmlHttp=new XMLHttpRequest();<br /><br /> }<br /><br />catch (e)<br /><br /> {<br /><br /> //Internet Explorer<br /><br /> try<br /><br /> {<br /><br /> xmlHttp=new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;);<br /><br /> }<br /><br /> catch (e)<br /><br /> {<br /><br /> xmlHttp=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);<br /><br /> }<br /><br /> }<br /><br />return xmlHttp;<br /><br /><br /><br />}<br /><br />&lt;/script&gt;<br /><br /><br /><br />&lt;/head&gt;<br /><br />&lt;body&gt;<br /><br />&lt;form name=&quot;employee&quot;&gt;<br /><br />&lt;br&gt;&lt;br&gt;<br /><br />&lt;table border=&quot;0&quot; width=&quot;400px&quot; align=&quot;center&quot; bgcolor=&quot;#CDFFFF&quot;&gt;<br /><br />&lt;tr&gt;&lt;td align=&quot;center&quot; colspan=2&gt;&lt;b&gt;Select Employee Id&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;%<br /><br />Connection conn = null;<br /><br /> String url = &quot;jdbc:<a href="mysql://localhost:3306/&quot"; target="_blank">mysql://localhost:3306/&quot</a>;;<br /><br /> String dbName = &quot;user_register&quot;;<br /><br /> String driver = &quot;com.mysql.jdbc.Driver&quot;;<br /><br /> String userName = &quot;root&quot;; <br /><br /> String password = &quot;root&quot;;<br /><br /><br /><br /> int sumcount=0; <br /><br /> Statement st;<br /><br /> try {<br /><br /> Class.forName(driver).newInstance();<br /><br /> <br /><br /> conn = DriverManager.getConnection(url+dbName,userName,password);<br /><br /> String query = &quot;select * from employee_details&quot;;<br /><br /> <br /><br /> st = conn.createStatement();<br /><br /> ResultSet rs = st.executeQuery(query);<br /><br /> %&gt;<br /><br /> <br /><br /> &lt;%<br /><br /> int count=0;<br /><br /> while(rs.next())<br /><br /> {<br /><br /> count++;<br /><br /> %&gt;<br /><br /> <br /><br /> &lt;tr&gt;&lt;td align=&quot;center&quot; width=&quot;50%&quot;&gt;<br /><br /> &lt;input type=&quot;hidden&quot; value=&quot;&lt;%=rs.getString(1)%&gt;&quot; id=&quot;eid&lt;%=count%&gt;&quot;&gt; <br /><br /> &lt;img src=&quot;redar.jpg&quot; width=&quot;25px&quot; height=&quot;25px&quot; name=&quot;myImage&quot; onclick=&quot;changeImage(this.id);&quot; id=&quot;myImage&lt;%=count%&gt;&quot; border=&quot;0&quot;&gt;<br /><br /> <br /><br /> &lt;%=rs.getString(1)%&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;%=rs.getString(2)%&gt;&lt;/td&gt;&lt;/tr&gt;<br /><br /> <br /><br /> &lt;%<br /><br /> }<br /><br /> %&gt;<br /><br /> <br /><br /> &lt;%<br /><br /> <br /><br /> }<br /><br /> catch (Exception e) {<br /><br /> e.printStackTrace();<br /><br /> }<br /><br /> <br /><br />%&gt;<br /><br /><br /><br />&lt;tr&gt;&lt;td align=&quot;center&quot; width=&quot;50%&quot;&gt;&lt;input type=&quot;button&quot; value=&quot;Select&quot; onclick=&quot;javascript:showEmp();&quot;&lt;/td&gt;&lt;/tr&gt;<br /><br /><br /><br /> <br /><br /> &lt;/table&gt;<br /><br /> &lt;/form&gt;<br /><br /> &lt;/body&gt;<br /><br /> &lt;/html&gt;<br /><br />--------------------------------------<br /><br />Thanks &amp; Regards<br /><br />Amardeep
More Questions
Post Answers
Ask Question Facing Programming Problem?
Useful Links
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net

Send your comments, Suggestions or Queries regarding this site at [email protected]

Copyright 2007. All rights reserved.