Reputation: 1537
response.Write("CurPage=" & CurPage & "<br />")
response.Write("iNumPages=" & iNumPages)
if CurPage < iNumPages then
response.Write("in correct part")
writepagebar = sStr & sLink & CurPage + 1 & """ rel=""next"">" _
& snext & "</a> " & sLink & iNumPages & """><span class=""pagebarquo""" _
& " style=""font-family:Verdana;font-weight:bold"">»</span></a>"
else
response.Write("in bad part")
writepagebar = sStr & " " & snext & " <span class=""pagebarquo""" _
& " style=""font-family:Verdana;font-weight:bold"">»</span>"
end if
What is wrong here? It's printing out
CurPage=11
iNumPages=52
So it should be going into the correct part...but it's going into the bad part.
I'm trying to make the Next word a hyper link...
Upvotes: 0
Views: 51
Reputation: 16950
Probably CurPage
is evaluating as String
.
Since it is possible to have a False
return value for an expression like "11" < 52
in VBScript, before comparing numeric variables you should make sure that its data type is also numeric, not string.
This will work as you expect.
if CLng(CurPage) < CLng(iNumPages) then
'correct part
else
'bad part
end if
Upvotes: 2