...

View Full Version : Resolved Button to increase or decrease var speed



exocintact
07-28-2009, 01:46 AM
I'm trying to create a button that will increase and decrease the var speed variable

ex:


var speed = 5

<input onclick="??????" type="button" value="Increase Var Speed">
<input onclick="??????" type="button" value="Decrease Var Speed">

Help, anyone?

ckeyrouz
07-28-2009, 01:50 AM
try this:

<input onclick="increase()" type="button" value="Increase Var Speed">
<input onclick="decrease()" type="button" value="Decrease Var Speed">

in your js code:


function increase()
{
speed = Number(speed ) + 1;
}

function decrease()
{
speed = Number(speed ) - 1;
}

exocintact
07-28-2009, 01:52 AM
it worked!

Thanks very much!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum