const tab_a = [];
const tab_b = [];
var przyklad=0, przyklady;
var liczba_a, liczba_b, wynik, blad=0, dobrze=0;
var countdown;
var element;
var cdTimer;
var Liczba = new String();
window.onload = load;
function load ()
{
przyklad=0, blad=0, dobrze=0;
var option1, option2;
for (a=1; a<=10; a++) {if (a==3) {select = ' selected="selected"';} else {select = ''; } option1 += '';}
for (a=2; a<=30; a=a+2) {if (a==10) {select = ' selected="selected"';} else {select = ''; } option2 += '';}
option2 += ''
var tresc_diva = '
An application to improve your multiplication art is ahead of you. With it, learning the multiplication table will be easier. You choose the number of examples and the time to solve one, then the application draws two numbers from 1 to 10 and your task is to enter the correct multiplication of these two numbers.
Choose the number of examples to solve Choose the time (in seconds) to solve the example
START
Language:
';
document.getElementById("tabmn").innerHTML = tresc_diva;
}
function start()
{
przyklady = document.getElementById("przyklady").value
czas = document.getElementById("czass").value
rysuj();
losuj();
}
function stop ()
{
if(blad==1) strblad="only 1 error!";
else if ((blad>1 && blad<5)||(blad>21 && blad<25)||(blad>31 && blad<35)||(blad>41 && blad<45)||(blad>51 && blad<55)||(blad>61 && blad<65)||(blad>71 && blad<75)||(blad>81 && blad<85)||(blad>91 && blad<95)) strblad=blad + " mistakes!";
else strblad=blad + " mistakes!";
info="On " + przyklady + " examples you made " + strblad;
if(blad==0) info = "You have solved " + przyklady + " examples and you have not made any mistake. BRAVO!";
else if(blad==przyklady) info += " One thing is certain, without a calculator you will not survive in this brutal world ;-)";
// info += ' Restart';
document.getElementById("czas").innerHTML = '';
document.getElementById("czas").style.backgroundColor = "";
// document.getElementById("zadanie").innerHTML = '';
document.getElementById("zadanie").style.display = 'none';
document.getElementById("przyciski").style.display = 'none';
document.getElementById("restart").style.display = 'block';
document.getElementById("koniec").innerHTML = info;
document.getElementById("koniec").style.display = 'block';
}
function losuj ()
{
if (przyklad>=przyklady)
{
setTimeout("stop()", 500);
} else {
przyklad++;
poz_liczba = Math.floor(Math.random() * (tab_a.length));
liczba = tab_a[poz_liczba];
tab_a.splice(poz_liczba, 1);
liczba_a = Math.floor(liczba/10);
liczba_b = liczba - liczba_a*10;
if (liczba_b == 0) liczba_b = 10;
element = "a" + liczba_a + "b" + liczba_b;
wynik = liczba_a*liczba_b;
// document.getElementById(element).style.borderColor = "purple";
document.getElementById(element).style.backgroundColor = "purple";
document.getElementById("zadanie").innerHTML = liczba_a+'*'+liczba_b+'=?';
for (a=0; a 47) && (key < 58)) || ((key > 95) && (key < 106))) {
if (key > 95) { key-=48; }
key-=48;
zawartosc = document.getElementById(element).innerHTML
if (zawartosc.length < 3) document.getElementById(element).innerHTML = zawartosc+key;
} else if(key==13) {
clearTimeout(cdTimer);
wyniczek();
losuj();
} else if(key==8) {
zawartosc = document.getElementById(element).innerHTML
n = zawartosc.length;
if(n > 1) zawartosc = zawartosc.substr(0,n-1);
else if(n==1) zawartosc="";
document.getElementById(element).innerHTML = zawartosc;
}
return true;
}
function klik(key)
{
if (key >= 0 && key <= 9)
{
zawartosc = document.getElementById(element).innerHTML
if (zawartosc.length < 3) document.getElementById(element).innerHTML = zawartosc+key;
} else if(key==-1)
{
clearTimeout(cdTimer);
wyniczek();
losuj();
} else if(key==-2) {
zawartosc = document.getElementById(element).innerHTML
n = zawartosc.length;
if(n > 1) zawartosc = zawartosc.substr(0,n-1);
else if(n==1) zawartosc="";
document.getElementById(element).innerHTML = zawartosc;
}
return true;
}
function wyniczek ()
{
document.onkeydown=nullevent;
document.onclick=nullevent;
zawartosc = document.getElementById(element).innerHTML
if (wynik != zawartosc)
{
blad++;
document.getElementById(element).style.backgroundColor = "red";
} else {
dobrze++;
document.getElementById(element).style.backgroundColor = "green";
}
document.getElementById(element).innerHTML = wynik;
document.getElementById(element).style.borderColor = "gray";
for (a=0; a*';
} else if (a==0)
{
tresc_diva = tresc_diva + '