Javascript function call not behaving the way I expect
<p>here is the html:</p>

<pre><code>&lt;table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"&gt;
    &lt;tr align="center" valign="middle"&gt;
      &lt;td width="10" class="pagestyle" onClick="pageNo(-1);" align="right"&gt;&amp;laquo;&lt;/td&gt;
      &lt;td id="pageNum" class="pagestyle"&gt;1/5&lt;/td&gt;
      &lt;td width="10" class="pagestyle" onClick="pageNo(+1);" align="left"&gt;&amp;raquo;&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>And here is the corrosponding javascript:</p>

<pre><code>var page = 0;
function pageNo(off) {
    if (((page + off) &gt; -1) &amp;&amp; ((page + off) &lt; 6)) {
     page = page + off;
     parseRSS(page);
    } else if ((page + off) === 6) {
     page = 0;
     parseRSS(page);
    } else if ((page + off) === -1) {
     page = 5;
     parseRSS(page);
    }
}
</code></pre>

<p>What this is supposed to do is start with page 1, which it does, and count up or down depending on the link clicked. However, when we get to page 5, I have to click twice to go back to page 1. What is causing the double-click behavior?</p>
