473,698 Members | 2,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use of hide box on a jsp page using javascript

12 New Member
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 2472
Dormilich
8,658 Recognized Expert Moderator Expert
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
shashikala
12 New Member
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 Recognized Expert Moderator Expert
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
shashikala
12 New Member
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
buy domain
6 New Member
Make hidebox invisible initially and make it visible only when user clicks on corresponding element.
Aug 29 '13 #6
Dormilich
8,658 Recognized Expert Moderator Expert
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
shashikala
12 New Member
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
shashikala
12 New Member
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
1794
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 I want to present a simple page containing just the links. The original page is not "mine", that is, I can't just edit it in notepad and stick some javascript in it.
4
2853
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 of July 31, if I
2
8421
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 Select box is named in the same convention ie. ddl_DeliveryStatus_ and then the recordID and contains the same options in the same order. The number of select boxes changes every time the page is loaded as this is all built using ASP linked to a...
1
2691
by: ruchinagaich1 | last post by:
Please tell me, How do i open a hyperlink in parent page using javascript?
7
6231
by: vunet.us | last post by:
Can I get the name of a referral page using JavaScript? Just really wondering...
1
1968
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 refreshed at regular intervals without refreshing the page. this has to implemented using javascript can anyone help me out ??
3
7365
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 apps: MS Excel What I need to do: From a web page using javascript, I open a new Excel application and sheet, populate some information into it. After it is populated with some information, I need to run the "Solver..." option on the data in the...
1
4124
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
2278
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 javascript (such as a teacher drawing a circle around part of the text or image on the page to point it out to the students). I'm not sure how i would do this but think it may have something to do with the <canvashtml element?
4
3615
Ashwani Sharma
by: Ashwani Sharma | last post by:
is there any way to save a web page using javascript in cross browser
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.