Hi I am having a problem with a simple ifelse statement, i can feel the answer is staring me in the face but i just cant suss it.
It's an ifelse statement that should increment a var from the current month number to 12(dec) then to 1()jan, another goes from current month no. to 1(jan) then to 12(dec)
What happens however is that it just keeps incrementing or decrementing and breaks the code when Tmonth = < 1 or > 12 when executing monthname(Tmonth)
Here is the code
Thanks in advance
It's an ifelse statement that should increment a var from the current month number to 12(dec) then to 1()jan, another goes from current month no. to 1(jan) then to 12(dec)
What happens however is that it just keeps incrementing or decrementing and breaks the code when Tmonth = < 1 or > 12 when executing monthname(Tmonth)
Here is the code
Thanks in advance
Code:
<%
Tmonth = Month(Date())
tnow = Month(now)
adder= Request.QueryString("calnav")
counted= Request.QueryString("count")
if adder = "" then
counted = "0"
Tmonth = Month(Date()) + counted
Response.Write("loop 1")
elseif adder = "plus" and Tmonth = 12 then
counted = 0
Tmonth = 1
elseif adder = "plus" then
counted = counted + 1
Response.Write(counted & " pos <br>")
Response.Write("loop 2 <br>")
elseif adder = "minus" and Tmonth = 1 then
counted = 0
Tmonth = 12
elseif adder = "minus" then
counted = counted - 1
Response.Write(counted & "neg")
Response.Write("loop 3")
end if
%>
<html>
<body>
<a href="shortcalxp.asp?calnav=minus&count=<%=counted%>"><-- (last month)</a>
<a href="shortcalxp.asp?calnav=plus&count=<%=counted%>">--> (next month)</a>
</body>
</html>

