Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

javascript....keeping count


ghost's Avatar
0 0

i am writing a script that involves how many times an object is clicked ie.. if it is clicked one time this happens if it is clicked another time this happens ….. so i am trying to figure out how to make the script remember how many times the object was clicked so as to know what code to execute

thanks for your time..

[edit]i found a way around my problem but if anyone does know how you might be able to count how many times an alert box has been activated or the above Q i would be most appreciative

thanks again…[/edit]

-pokjomama


ghost's Avatar
0 0

Pseudo-code-likeness:


....

<object onclick="javascript:alert(count++; count;);">```

Just declare a variable at global scope, and then just call an incremental function and then your javascript alert.

ghost's Avatar
0 0

thats pretty much what i ended up doing. .. just with a small array…

thanks for the advice… check out my prof to see what it was for if you are bored :happy: bear in mind that i am still learning and there is a few aspects that need adjusting when i have some time…

-pokjomama