Hey
I am a noob to JavaScript so sorry if this is a stupid question. I am trying to make a counter that counts how many times a user clicks on a image but I cannot get it to work.
Javascript code
Pic Code
My best guess is it is something to do with me having the same variable inside that variable if you get me. When I change the variable inside “count” to just a number it adds them fine.
Any help would be great
Thanks
I am a noob to JavaScript so sorry if this is a stupid question. I am trying to make a counter that counts how many times a user clicks on a image but I cannot get it to work.
Javascript code
Code:
<script type="text/JavaScript">
function add()
{
count = count + 1
alert(count)
}
</script>
Pic Code
Code:
<img src="cards/s2.gif" onclick= "add()"/>
My best guess is it is something to do with me having the same variable inside that variable if you get me. When I change the variable inside “count” to just a number it adds them fine.
Any help would be great
Thanks
Last edited: