Having problems w/ JavaScript I created. Works fine up until you get to 10, 20, and 30 so on. Any assistance would be greatly appreciated
function GetGotoPageUrlString (nPageNumber,sUrlText)
{
return “<a href=’JavaScript:GotoPage(” + nPageNumber + “);’ style=’TEXT-DECORATION: none;’>” + sUrlText
+ “</a>”;
}
function WritePagination(mypage,maxpages)
{
if (maxpages > 1 && mypage <= maxpages)
{
var str = “?euA? “;
strObj = new String(str);
var i=0;
for (i=0; i<strObj.length; ++i)
document.write(String.fromCharCode(strObj.charCodeAt(i)-3));
var counterstart = mypage – (202-i);
if (mypage%10) counterstart = mypage – (mypage%10) + 1;
var counterend = counterstart + 9;
if (counterend > maxpages) counterend = maxpages;
if (counterstart != 1)
document.write(“border=’0′><tr valign=’center’><td align=’center’>” + GetGotoPageUrlString(1,”First”)+” : ”+GetGotoPageUrlString(counterstart – 1,”Previous”)+” <b>[</b>”);
var pad=””;
var counter = counterstart;
for(;counter<=counterend;counter++)
{
if (counter != mypage) document.write(“ ” + GetGotoPageUrlString(counter,pad + counter));
else document.write(“ <b>” + pad + counter + “</b>”);
}
document.write(“ <b>]</b>”);
if (counterend != maxpages) document.write(“ ” + GetGotoPageUrlString (counterend + 1,”Next”) + “ : ” + GetGotoPageUrlString(maxpages,”Last”))
document.write(“</td></tr></table>”);
}
}
function WritePaginationHeader(mypage,maxpages,recordCount)
{
document.write(“<table border=’0′ width=’100%’><tr valign=’center’><td align=’left’>”);
document.write(“<a href=edit.asp onClick=”javascript: document.forms.editform.action.value = ‘add’; document.forms.editform.pagenumber.value=” + mypage + “; document.forms.editform.submit(); return false;” >Add new</a>”);
document.write(“</td><td align=right>”);
document.write(“Details found: ” + recordCount + “<br>Page ” + mypage + ” of ” + maxpages);
document.write(“</td></tr></table>”);
}
Thanks,
Noel