You should use --_01
_01--
will do -1
after the expression.
Question
minOne = document.getElementById("ctdwnTimeDispSec").value=_01--;
minOne = document.getElementById("ctdwnTimeDispSec").value=_01-1;
Solution 2
--_01
_01--
will do -1
after the expression.
OTHER TIPS
The -- operator will decrement the number it's operated on, during or after the statement, based on whether it is placed before or after the number.
e.g. Placing -- after a
, will modify the value of a
, on the following line.
var a=5
var b=a--
afterwards, will equal:
a=4
b=5
e.g. Placing -- before a
, will modify a
on the same line.
var a=5
var b=--a
afterwards, will equal:
a=4
b=4
When you use var b=a-1
, the javascript will execute the a-1
on that line, making b=4
, and not changing a
. Make sense?
You will need to use the pre decrrement operator instead of post decrement operator, other you can get the decremented value after that expression.