Paging i Javascript.
En der kan hjælpe men en paging fuktion i dette script.--------------
<html>
<head>
<%
strDSN = "conn"
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open strDSN
strSQL = "SELECT count.site, Count(count.site) AS taeler, sites.http, sites.titel, sites.beskrivelse, sites.tilmeld FROM sites INNER JOIN count ON sites.idnr = count.site where DATEDIFF(day, reg, getdate()) <= 7 GROUP BY count.site, sites.http, sites.titel, sites.beskrivelse, sites.tilmeld;"
Set rs = myConn.Execute(strSQL)
%>
<script type="text/javascript">
listen = new Array();
<%
do while not rs.eof
if date() - rs(5) > 7 then
tid = 7
else
tid = date() - rs(5)
end if
if tid = 0 then tid = 1
if rs(0) <> "" and rs(1) <> "" and rs(2) <> "" and rs(3) <> "" and rs(4) <> "" and rs(5) <> "" then
%>
listen[listen.length] = new Array(<%=Round(rs(1)/tid, 0)%>,<%=rs(0)%>,'<%=Replace(rs(2), "'","´")%>','<%=rs(3)%>','<%=Replace(rs(4), "'","´")%>');
<%
end if
rs.movenext
loop
%>
function docompare(b,c){
return b[0] - c[0];
}
function skriv(){
a = listen.sort(docompare).reverse();
str = "<table>";
for (i = 0; i < listen.length; i++){
str += "<tr><td></td>";
str += "<td>" + a[i][2] + "</td>";
str += "<td>" + a[i][3] + "</td>";
str += "<td>" + a[i][4] + "</td>";
str += "<td>" + a[i][0] + "</td></tr>";
}
str += "</table>";
document.all.her.innerHTML = str;
}
</script>
</head>
<body onload="skriv()">
<div id="her"></div>
</body>
</html>
------------------
