Click to See Complete Forum and Search --> : javascript: simple counter (decrease/increase with case)


NiCkReD
May 26th, 2005, 05:37 AM
hello,
i want to make a counter. It is something strange that i want to do.

Well, i want to check 2 variables and then if one variable is bigger/lower to increase/decrease a counter.

I had make one but the max number was only 1/-1



<SCRIPT>
<!--
R1=(will be from 0-1024);
R2=(will be from 0-1024);
var R11=0;
var R22=0;
var R3=0;

if (R1<100)
R11++;

if (R2<100)
R22++;

if (R11>R22)
R3++; //my problem is here. it can't take more than 1
if (R11<R22)
R3--; //same here

document.write(R11);
document.write(R22);
document.write(R3);

// -->
</SCRIPT>



also, i want to check it every 50ms if this could be possible....

could you please help me?

Thak you in advanced :)

B-80
May 26th, 2005, 11:17 PM
PHP would be better suited for the 50 mins thing, why is everything a comment? and just put:
if (varA > varB)
count++;
else
count--;

NiCkReD
May 27th, 2005, 08:07 AM
it doesn't work.is the same thing as i have done.
on php i can't work because the module i work with it can't wokr. It works only with htm,java,lava applets!

i should find a way to do a loop and take tha results on other page!!!