wolwayne 0 Newbie Poster

By using javascript, what I wanna do is that when a user click on a headline on wc_page.jsp a new page news.jsp will open. This page conatins all the news date-wise. Suppose a user clicks on the headline which is at number 5 on news.jsp page, I want to open the news.jsp page and I want that the page automatically scrolls to the 5th news.

wc_page.jsp

    <h2>Newsdesk</h2>
        <p> 
            <% Iterator itr;%>
            <% List data=(List)request.getAttribute("data");
            for(itr=data.iterator(); itr.hasNext(); ){
            %>

    <input type="hidden" name="" value="<%=itr.next()%>" />
    <p>Date:    <%=itr.next()%><br>
    <strong>Breaking News:</strong> <a href="news"><%=itr.next()%></a>
    <br>
    <strong><%=itr.next()%></strong>
    <input type="hidden" name="" value="<%=itr.next()%>" /></p>

        <%}%>
     <p class="readmore"><a href="news"><strong>View Full News &raquo;</strong></a></p>
    </br> 

news.jsp

<div>
 <p>
    <% Iterator itr;%>
    <% List data=(List)request.getAttribute("data");
    for(itr=data.iterator(); itr.hasNext(); ){
    %>
<br>
<input type="hidden" name="news_id" value="<%=itr.next()%>" />
  <br><strong>Date</strong><%=itr.next()%>
  <br><strong>Headline :</strong><%=itr.next()%>
  <br><strong>Story :</strong><%=itr.next()%>
  <br><strong>Details</strong><%=itr.next()%>
  <br>
 </p>
<%}%>
</div>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.