function start() { if (button.value == "ON") { // something to start repeating a desired function said amount of times here... or something } }