Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using onload window onload to go to bookmark

Status
Not open for further replies.

petbully

Technical User
Dec 6, 2009
7
0
0
US
Hi,

My asp page displays rows of data. It has a button which has a function to submit itself and add 5 more rows to the page. After adding new rows to the page, I want to redisplay the page but go directly to the area of the new rows, not from the top of the page. I do this by using onload function. The problem is when I use back button.

Let's say first time when I come in this page I see the page with 10 rows. After click a button, I got a page with 15 rows and it display to the area of the new rows. When I click back button, I want it to go back to the page with 10 rows. But instead it goes to the page with 15 rows (and display at the top of the page).
Please help. Below is my code snipplet.
Code:
<script type="text/javascript">
    onload = function()
	{
	    	    var target = "#rowpos" + document.f1.XROWCNT.value;
	    window.location.href = target;
      		
	}
  </script>
Code:
<%for i = 0 to strrowcnt %>
		  <tbody>
		 <tr><td bgcolor="#999999" colspan="41" ><a name="rowpos<%=(i)%>"></a><img src="images/spacer.gif" width="1" height="1" border="0"></td></tr> 
          </tbody>
		  <tr>
		  
         
		  <td width class="ver10pxblk"><input type="Text" name="XCODE<%=i%>" size="10"  maxlength="10" value="<%=code(i)%>" ></td>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top