473,395 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

use of hide box on a jsp page using javascript

Hi all,
I need to display a table column values using rs.next in jsp. Now i want to use these entries as links to show the hide box that contains other information corresponding to that column value. Is there any way to do this? The method which i am using displays hide box corresponding to each column value. Bur i want that it only displays hidebox for the link or column value clicked. Any solution will be appriciated.
Regards.
Aug 24 '13 #1
8 2457
Dormilich
8,658 Expert Mod 8TB
the first thing you should take in is that JSP is on the server and JavaScript is on the client (browser). i.e. JS code works on the output created by JSP.

so it would be helpful to know the HTML created from JSP.
Aug 25 '13 #2
Hey Dormilich. Thankyou for the reply. Well let me send you my code n i hope you understand the problem with it.

Expand|Select|Wrap|Line Numbers
  1.  //js code
  2. <script type="text/javascript">
  3.            function showHide() {
  4.     var ele = document.getElementById("showHideDiv");
  5.     if(ele.style.display == "block") {
  6.           ele.style.display = "none";
  7.     }
  8.     else {
  9.       ele.style.display = "block";
  10.     }
  11. }
  12. </script>
  13. //jsp code
  14. <body>
  15. <%
  16.  try{
  17.              Class.forName("oracle.jdbc.OracleDriver");
  18.        con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","swati","goyal");
  19.        ps1=con.prepareStatement("select * from register where status='No'");
  20.        rs1=ps1.executeQuery();
  21.        while(rs1.next()){
  22.        s1=rs1.getString(2);%>
  23.           <a href="javascript:showHide()"><% out.println(s1);%>
  24.  
  25.               <div id="showHideDiv" style="display: none;">
  26. <%
  27.  try{
  28.  
  29.        ps=con.prepareStatement("select * from register where name=? and status='No'");
  30.        ps.setString(1, s1);
  31.        rs=ps.executeQuery();
  32.        if(rs.next()){
  33.        out.println(rs.getString(2));
  34.        out.println(rs.getString(4));
  35.        out.println(rs.getString(5));
  36.        out.println(rs.getString(6));%>
  37.       <form action="ALApproval.do" align="right">
  38.           <input type="hidden" name="h1" value="<%=rs.getString(2)%>"/>
  39.           <input type="hidden" name="h2" value="<%=rs.getString(6)%>"></input>
  40.           <input type="submit" class="buttn" onclick=""/>
  41.       </form>
  42.  
  43.       <% }
  44.  
  45.        }catch(Exception e){System.out.println(e);}
  46. %>
  47. </div>
  48.  
  49.               <br/>
  50. </a>
  51.  <% }
  52.        }catch(Exception e){System.out.println(e);}
  53. %>
  54. </body> 
Aug 26 '13 #3
Dormilich
8,658 Expert Mod 8TB
it would be really helpful if you could post the code that you get in the browser. I am not a JSP expert to do that conversion by myself.
Aug 26 '13 #4
Sorry, what do you mean by the browser code? I just want to know how to use hide/show box efficiently.
I think you are not getting my problem :-(
Aug 29 '13 #5
Make hidebox invisible initially and make it visible only when user clicks on corresponding element.
Aug 29 '13 #6
Dormilich
8,658 Expert Mod 8TB
Sorry, what do you mean by the browser code? I just want to know how to use hide/show box efficiently.
what do you think, on what code does JavaScript work:
a) JSP sorce code
b) HTML source code
Aug 29 '13 #7
hey buy domain.. that is what i am asking how to make it visible for that particular element? rather it makes the hide box visible for each element upon clicking any one element.
Aug 30 '13 #8
javascript workd on the html code. that is why i have called showHide() in the html source code and the rest of the logic is in jsp.
Expand|Select|Wrap|Line Numbers
  1.  <a href="javascript:showHide()">
Aug 30 '13 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Eric Osman | last post by:
Let's say I want to filter the contents of a target web page, and present a simpler page on the screen. For example, let's say a target web page is full of links, text, images, forms, etc. and...
4
by: ianv2 | last post by:
Hi Is the following possible using Javascript ? I would like a page to redirect to another page if the page expiry has passed. E.G. If my questionnaireform.html page had an expiry date...
2
by: simon.wilkinson | last post by:
Hi, I am trying to update all Select boxes on a page dynamically using javascript, I simple want to change the selected item in each select box when a tick box is pressed on the page. Each...
1
by: ruchinagaich1 | last post by:
Please tell me, How do i open a hyperlink in parent page using javascript?
7
by: vunet.us | last post by:
Can I get the name of a referral page using JavaScript? Just really wondering...
1
by: lakshmishri | last post by:
hi all can anyone answer this ?? i have developed a module which displays cricket score card and this is one of the part in a HTML page along with other modules. now this module alone must be...
3
by: akristensen | last post by:
I am new to this site, so be patient if I do not ask the question correctly. Current Target Platform: Browser: MS IE, script language: Javascript (will use VBScript, but JS is preferred), External...
1
by: fastvarun | last post by:
Can anybody help me how to remove url while print out of a page using javascript window.print() plz help me...........................
28
by: macca | last post by:
Hi, I'm developing an application that is going to be used in schools as a teaching aid and require the ability to temporarily draw on my (as in pages produced by my application) web page using...
4
Ashwani Sharma
by: Ashwani Sharma | last post by:
is there any way to save a web page using javascript in cross browser
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.