Delay between while loop iterations
I am trying to write a program to assist me in learning to play the piano. I have set up three buttons that will each call a function to randomly spit out chord names.
The problem I am having is that I want a 3 second delay within the while loop between chord names. I have looked around on the net and can't seem to see how to do it. Here is the code for the first function:
MAJORS = new Array('A','B','C','D','E','F','G');
MINORS = new Array('Am','Bm','Cm','Dm','Em','Fm','Gm');
MIXED = new Array('A','B','C','D','E','F','G','Am','Bm','Cm','Dm','Em','Fm','Gm');
var iterations = 20;
var timeDelay = 3000;
var i =0;
rand = parseInt(Math.floor(Math.random()*6));
<input type="button" value="Majors" onclick="randomiseMajors()" />
<p><input type="button" value="Minors" onclick="randomiseMinors()" /></p>
<p><input type="button" value="Mixed" onclick="randomiseMixed()" /></p>
Also, is it easy to display the chord names one at a time? ie when a new chord is displayed the previous one disappears. (This question is not so important I am more interested in the Timeout question).
Thanks for your help!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread