Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
document.body.scrolltop
<input type=hidden name=thePosition>
<td style="cursor:hand" onClick="sortTable('sortValue');">
<script language=javascript>
function sortTable(sortVal){
//do what you need to do with the sortVal, and then
// you will set the value of your hidden element like
// this
document.theForm.thePosition.value = document.body.scrollTop;
//now, you need to submit your form:
document.theForm.submit();
}
</script>
<%
dim thePosition
thePosition = request.form("thePosition")
%>
<%
if thePosition <> "" then%>
<script language=javascript>
document.body.scrollTop = <%=thePosition%>;
</script>
<%
end if%>
<%@language=vbscript%>
<%option explicit%>
<%
dim thePosition
thePosition = request.form("thePosition")
'Here's where you might want to grab the 'sortVal' --
' assuming you assigned it to some other hidden form
' variable, you could grab it here and tack it onto the
' end of your SQL Statement that you use to grab your
' data from the db. Put it in your ORDER BY clause to
' resort your data by the desired criteria. And if you
' really want to get fancy, keep a sort direction stored
' too -- so that if they click the same cell, it sorts in
' the opposite direction. But I digress.
%>
<HTML>
<HEAD>
<title>display.asp</title>
<script language=javascript>
function sortTable(sortVal){
//do your thing with sortVal
// this will differ depending on the app
document.theForm.thePosition.value = document.body.scrollTop;
document.theForm.submit();
}
</script>
</HEAD>
<BODY>
<form name=theForm method=post action=display.asp>
<table cellpadding=10 border=1>
<tr>
<td style="cursor:hand" onClick="sortTable('sortValue1');" nowrap bgcolor=lightblue>
Header 1
</td>
</tr><tr>
<td>
Position 1
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue2');" nowrap bgcolor=lightblue>
Header 2
</td>
</tr><tr>
<td>
Position 2
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue3');" nowrap bgcolor=lightblue>
Header 3
</td>
</tr><tr>
<td>
Position 3
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue4');" nowrap bgcolor=lightblue>
Header 4
</td>
</tr><tr>
<td>
Position 4
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue5');" nowrap bgcolor=lightblue>
Header 5
</td>
</tr><tr>
<td>
Position 5
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue6');" nowrap bgcolor=lightblue>
Header 6
</td>
</tr><tr>
<td>
Position 6
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue7');" nowrap bgcolor=lightblue>
Header 7
</td>
</tr><tr>
<td>
Position 7
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue8');" nowrap bgcolor=lightblue>
Header 8
</td>
</tr><tr>
<td>
Position 8
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue9');" nowrap bgcolor=lightblue>
Header 9
</td>
</tr><tr>
<td>
Position 9
</td>
</tr><tr>
<td style="cursor:hand" onClick="sortTable('sortValue10');" nowrap bgcolor=lightblue>
Header 10
</td>
</tr><tr>
<td>
Position 10
</td>
</tr>
</table>
<input type=hidden name=thePosition>
</form>
<%
if thePosition <> "" then%>
<script language=javascript>
document.body.scrollTop = <%=thePosition%>;
</script>
<%
end if%>
</BODY>
</HTML>