-
Notifications
You must be signed in to change notification settings - Fork 0
/
hitrost_opazovanja.php
287 lines (204 loc) · 5.29 KB
/
hitrost_opazovanja.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<html>
<head>
<title>hitrost opazovanja</title>
<meta charset="utf-8" />
<link rel="stylesheet" type='text/css' href='hitrost_opazovanja_stil.css'>
</head>
<body bgcolor="#FAFAFA">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<center>
<h1>HITROST OPAZOVANJA </h1>
<button id="gumb1">začni</button>
<button id="gumb_navodila">navodila</button>
<button id="sirina"> trenutna širina je 5</button>
<button id="visina"> trenutna visina je 4</button>
<a href='glavna_stran.html'>nazaj na glavno stran<a>
<br>
<div id="navodila"> v tabeli se ti prikažejo števila od 1 do 20 klikni nanje v vrstnem redu od 1 do 20 v čim krajšem času</div>
<table border='1'>
<tr>
<td>
<font id="sds" class='tema4'>0</font>
</td>
<td><font class='tema4'> čas</font></td>
<td>
<font id="ura" class='tema4'>0</font>
</td>
</tr>
</table>
<div id="cestitke"> v tabeli se ti bodo prikazalae </div>
<table border='1' id='tabela'>
<tr> <td> dfsffds </td> <td> dfsffds </td> </tr>
<tr> <td> dfsffds </td> <td> dfsffds </td> </tr>
</table>
<form id='myform' method='post'>
Name:<input type='text' name='name'>
<button id="sub">submit </button>
</form>
</center>
<script src='skupne_funkc.js'></script>
<script>
function notr(value, array) {
return array.indexOf(value) > -1;
}
function zaporedje(n){
var g=1;
var seznam=new Array();
while(g<n+1){
var f=Math.floor(Math.random()*n+1);
if(notr(f,seznam)==false){
//document.write(f);
seznam.push(f);
g+=1;
}
}
return seznam;
}
function nakljucna_tabela2(a,b){
var sez2=zaporedje(a*b);
var sez=new Array();
var k=0;
for(var x = 0; x < a; x++){
var sez1=new Array();
for(var y = 0; y<b; y++){
sez1.push(sez2[k]);
k+=1;
}
sez.push(sez1);
}
return sez;
}
//<font size="6">This is some text!</font>
function unici(ime){
var element = document.getElementById(ime);
element.parentNode.removeChild(element);
}
//createTable([["row 1, cell 1", "row 1, cell 2"], ["row 2, cell 1", "row 2, cell 2"]]);
var vrstice=4;
var stolpci=5;
function createTable(tableData,ime) {
unici(ime)
var table = document.createElement('table');
//var tableBody = document.createElement('tbody');
table.id=ime
table.border=2;
table.align='center';
var liho=1;
tableData.forEach(function(rowData) {
var row = document.createElement('tr');
rowData.forEach(function(cellData) {
var cell = document.createElement('td');
cell.height=80;
cell.width=80;
if(liho%2==1){
cell.style.backgroundColor = "#2ECCFA";
}
else{
cell.style.backgroundColor = "#81F79F";
}
//cell.addClass("stevilke1");
cell.style.textAlign='center';
cell.style.fontSize="25px";
liho+=1;
cell.appendChild(document.createTextNode(cellData));
row.appendChild(cell);
});
table.appendChild(row);
});
//table.appendChild(tableBody);
document.body.appendChild(table);
}
var vrednost=1;
var cas=0;
var zacelo_se_je=false;
function myTimer(){
if(zacelo_se_je==true){
cas+=1;
$("#ura").text(cas);
}
}
function zacetek(){
if(zacelo_se_je==false){
zacelo_se_je=true;
}
}
var myVar = setInterval(myTimer,1000);
$('#gumb1').click(function(){
if(zacelo_se_je==false){
$('#vpisi2').hide();
$('#vpisi_se').hide();
$('#myform').hide();
$('#gumb1').text("koncaj");
createTable(nakljucna_tabela2(vrstice,stolpci),"tabela")
$("#tabela").show();
zacelo_se_je=true;
//naklucna=nakljucna_tabela2(vrstice,stoplci);
//createTable(nakljucna_tabela2(vrstice,stolpci),"tabela","t")
var q=1;
vrednost=1;
cas=0;
nova=new Array()
zap=zaporedje(vrstice*stolpci);
while(q<vrstice*stolpci+1){
$("#t"+q).text(zap[q-1]);
q+=1;
}
$("#cestitke").hide();
}
else{
$('#gumb1').text("začni");
zacelo_se_je=false;
cas=0;
vrednost=1;
$("#tabela").hide();
}
})
$('#sirina').click(function(){
stolpci+=1;
if(stolpci>8){
stolpci=2;
}
$('#sirina').text("trenutna st stolpcev je" +stolpci);
})
$('#visina').click(function(){
vrstice+=1;
if(vrstice>8){
vrstice=2;
}
$('#visina').text("trenutna st vrstic je" +vrstice);
})
$(document).ready(function(){
$("tabela td").css("text-align","center");
//$("#gumb1").hide();
$("#tabela").hide();
$("#cestitke").hide();
$('#myform').hide();
//$('#vpisi2').hide();
//$('#vpisi_se').hide();
})
$(document).on("click", "#tabela td", function() {
var data = $(this).text();
var data2=vrednost;
//$("#sds").text(data);
if(data2==data){
//$("#sds").text("branko zvonko tonko");
$(this).text("klik");
$("#sds").text("imate "+vrednost+" točk");
vrednost+=1;
if(vrednost==vrstice*stolpci+1){
zacelo_se_je=false;
$("#tabela").hide();
$("#cestitke").show();
$("#myform").show();
}
}
});
//$('#vpisi_se').click(function(){
// var imme=$('#vpisi2').val();
// //var imee="hhhhh";
// //$.get('php/shrani_vsebino.php',{input:imee},function(data));
// $('#odgovor').text(imee);
//})
</script>
</body>
</html>