Simple Javascript onclick issue
<p>I am trying to add onclick method to links.</p>

<p>I want to make a++ when user clicks the linkA and a-- when user clicks the linkB no matter what <code>a</code> value is.</p>

<p>My codes:</p>

<p>JS</p>

<pre><code>var a=0;

function swapPost(a){

 //I want to make a++ when user click linkA;
 //a-- when user click linkB
 //not sure how to do this

   if(a&gt;10){
    a=0;
   }
    if(a&lt;0){
    a=0;
   }

}

swapPost(a);
</code></pre>

<p>Html</p>

<pre><code>&lt;a href="#" onclick="swapPost(a)"&gt;LinkA&lt;/a&gt;
&lt;a href="#" onclick="swapPost(a)"&gt;LinkB&lt;/a&gt;
</code></pre>

<p>I was wondering if someone can help me out on this one. Thanks a lot.</p>
