0

i am using jquery code and it is being called inside while loop. the output is correct for the first time but the output is already displayed for the second tym. plz help me solve this prblem. here is the code.

<html>
<head>
 <script src="jquery-1.6.4.min.js" type="text/javascript"></script>
     <script type="text/javascript">
     $(document).ready(
     function()
     {
         $("#x").show();
       $("#y").hide();
        //$("$t:eq(1)").hide();
        //$("$t:eq(2)").hide();
         $("#x").click(

             function()
             {
               $("#y").show();
                // $("#t:eq(1)").show();
                 //$("#t:eq(2)").show();
             }
         );
     }
   );
  </script>
    </head>
    <body  bgcolor="#F3F3F3">
        <%
String userid=null;
if(session.getAttribute("visitor")!=null)
{
    userid=(String)session.getAttribute("visitor");
}
else
    {
response.sendRedirect("signin.jsp");
}
        if(request.getParameter("btnlogout")!=null)
    {
if(session.getAttribute("visitor")!=null)
    {
session.setAttribute("visitor",null);
response.sendRedirect("home.jsp");
}
else
    {
response.sendRedirect("pat_welcome.jsp");
}
}
%>
 <div> <%@include file="master.jsp"%></div>

        <div id="body1">
            <br/><br/><br/>
            <div style="margin-left:650px; ">
            <form action="#" method="get"><input type="submit" value="Logout" name="btnlogout" /></form></div>
               <br/><br/> <div id="main">
                    <div> <%@include file="leftdiv.jsp" %></div>
                    <div id="center">
                         <h2 style="color: indianred;">Articles</h2><br/>
<%
String id=null;
String dname=null;
String atitle=null;
String ades=null;
Connection con=null;
Statement smt=null;
ResultSet rs=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hcsds");
smt=con.createStatement();
rs=smt.executeQuery("select * from article");
while(rs.next())
{
id=rs.getString(1);
atitle=rs.getString(2);
ades=rs.getString(3);
dname=rs.getString(4);
%>

<div id="x" style="height:50px;width: 300px;">
<table border="0" cellpadding="5" cellspacing="10">
    <tr>
        <td>Title:</td>
        <td><%=atitle%></td>
    </tr>
    <tr>
        <td>Posted by:</td>
        <td><%=dname%></td>
    </tr>
</table>
</div>



<div id="y" style="height:100px; width: 300px;">
<table border="0" cellpadding="5" cellspacing="10">
    <tr>
        <td>Description:</td>
        <td><%=ades%></td>
    </tr>
</table>
</div>

       


<%
}
}
catch(Exception ex)
{
out.println(ex.getMessage());
}
%>

                    </div>
                    <div id="gap"></div></div></div>
        <center><hr size="2px" width="900px" color="gray"/></center>
        <div><%@include file="footer.jsp"%></div>
    </body>
</html>
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pzuurveen
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.