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
| <!DOCTYPE html>
<html>
<HEAD>
<TITLE>Закрытие окна через заданное время</TITLE>
<link rel="stylesheet" type="text/css" href="../team/style.css">
<script type="text/javascript">
id=window.setTimeout("Update();",10000);
function Update(){
alert('123');
javascript:window.close();
}
</script>
</HEAD>
<BODY background="../img/bg.jpg">
<h1>ТЕСТ - 11 вопросов на основные знасия JavaScript</h1>
<form>
<p><bb>1) Какой оператор из этих - выполняет не только математические операции?</bb><br>
<label>
<input type="radio" name="math" value="*">
*</label>
<br>
<label>
<input type="radio" name="math" value="/">
/</label>
<br>
<label>
<input type="radio" name="math" value="+">
+</label>
<br>
<label>
<input type="radio" name="math" value="-">
-</label>
<br>
<label>
<input type="radio" name="math" value=">>>">
>>></label>
<br>
</p>
<p><bb>2) Какие из этих тагов соответствуют стандарту HTML (strict) ?</bb><br>
<label>
<input type="checkbox" name="strict" value="1">
<script></label>
<br>
<label>
<input type="checkbox" name="strict" value="2">
<script type="text/javascript"></label>
<br>
<label>
<input type="checkbox" name="strict" value="3">
<script language="javascript"></label>
<br>
<label>
<input type="checkbox" name="strict" value="4">
<script language="javascript" type="text/javascript"></label><br>
<label>
<input type="checkbox" name="strict" value="5">
<script type="application/x-javascript"></label>
</p>
<p><bb>3) Можно ли инициировать DOM-событие из javascript?<br>
Например, сэмулировать клик мышкой на элементе, чтобы javascript-код кликнул за пользователя.</bb><br>
<label>
<input type="radio" name="dom" value="Да, можно">
Да, можно</label>
<br>
<label>
<input type="radio" name="dom" value="Нет, нельзя">
Нет, нельзя</label>
<br>
<label>
<input type="radio" name="dom" value="В некоторых браузерах можно">
В некоторых браузерах можно</label>
</p>
<p><bb>4) Что из этого - не событие мыши ?</bb><br>
<label>
<input type="radio" name="mouse" value="onmousescroll">
<code>onmousescroll</code></label>
<br>
<label>
<input type="radio" name="mouse" value="onclick">
<code>onclick</code></label>
<br>
<label>
<input type="radio" name="mouse" value="onmouseover">
<code>onmouseover</code></label>
<br>
<label>
<input type="radio" name="mouse" value="onmousemove">
<code>onmousemove</code></label>
<br>
<label>
<input type="radio" name="mouse" value="onmousewheel">
<code>onmousewheel</code></label>
</p>
<p><bb>5) Какие конструкции для циклов есть в javascript?</bb><br>
<label>
<input type="radio" name="cikl" value="2">
Только две: <code>for</code> и <code>while</code>.</label>
<br>
<label>
<input type="radio" name="cikl" value="1">
Только одна: <code>for</code></label>
<br>
<label>
<input type="radio" name="cikl" value="3">
Три: <code>for, while</code> и <code>do...while</code>.</label>
</p>
<p><bb>6) В каком случае из перечисленных событие не попадет на обработку javascript?</bb><br>
<label>
<input type="radio" name="obr" value="1">
Если в момент его наступления обрабатывается другое событие</label>
<br>
<label>
<input type="radio" name="obr" value="2">
Если страничка просматривается локально, т.е offline</label>
<br>
<label>
<input type="radio" name="obr" value="3">
Только если javascript отключен</label>
</p>
<p><bb>7) Что делает код: <textarea rows="1" cols="9" disabled>break me;</textarea></bb><br>
<label>
<input type="radio" name="break" value="1">
Ломает интерпретатор javascript</label>
<br>
<label>
<input type="radio" name="break" value="2">
Выходит из текущего блока цикла или switch на метку "me"</label>
<br>
<label>
<input type="radio" name="break" value="3">
Выдает ошибку</label>
<br>
<label>
<input type="radio" name="break" value="4">
В разных браузерах по-разному</label>
</p>
<p><bb>8) Какое событие не вызывается кликом мыши ?</bb><br>
<label>
<input type="radio" name="click_mouse" value="1">
<code>onfocus</code></label>
<br>
<label>
<input type="radio" name="click_mouse" value="2">
<code>onclick</code></label>
<br>
<label>
<input type="radio" name="click_mouse" value="3">
<code>onkeydown</code></label>
<br>
<label>
<input type="radio" name="click_mouse" value="4">
<code>onmousedown</code></label>
</p>
<p><bb>9) Какие из этих вариантов задают массив из элементов "a", "b" ?</bb><br>
<label>
<input type="checkbox" name="massiv" value="1">
<code>var a = new Array("a","b")</code></label>
<br>
<label>
<input type="checkbox" name="massiv" value="2">
<code>var a = { "a", "b" }</code></label>
<br>
<label>
<input type="checkbox" name="massiv" value="3">
<code>var a = ( "a", "b" )</code></label>
<br>
<label>
<input type="checkbox" name="massiv" value="4">
<code>var a = [ "a", "b" ]</code></label>
<br>
<label>
<input type="checkbox" name="massiv" value="5">
<code>var a = "a,b".split(',')</code></label>
</p>
<p><bb>10) Сколько параметров можно передать функции ?</bb><br>
<label>
<input type="radio" name="func" value="1">
Ровно столько, сколько указано в определении функции</label>
<br>
<label>
<input type="radio" name="func" value="2">
Сколько указано в определении функции или меньше</label>
<br>
<label>
<input type="radio" name="func" value="3">
Сколько указано в определении функции или больше</label>
<br>
<label>
<input type="radio" name="func" value="4">
Любое количество</label>
</p>
<p><bb>11) Где в документе может располагаться тэг script по стандарту HTML ?</bb><br>
<label>
<input type="radio" name="script" value="1">
Только в HEAD</label>
<br>
<label>
<input type="radio" name="script" value="2">
Только в BODY</label>
<br>
<label>
<input type="radio" name="script" value="3">
В HEAD или в BODY</label>
<br>
<label>
<input type="radio" name="script" value="4">
Где угодно, главное чтоб был</label>
</p>
<input type="button" id="calc" value="Подсчитать результаты">
</form>
<script type="text/javascript">
calc.onclick = function(){
var myform = this.form,
chbx = myform['strict'],
chbx2 = myform['massiv'],
sum = 0;
for(var i = 0; i < chbx.length; i++){
if(chbx[i].checked && (chbx[i].value == '2' || chbx[i].value == '5'))
sum++;
}
for(var i = 0; i < chbx2.length; i++){
if(chbx2[i].checked && (chbx2[i].value == '1' || chbx2[i].value == '4' || chbx2[i].value == '5'))
sum++;
}
if(myform.math.value == '+') sum++;
if(myform.dom.value == 'Да, можно') sum++;
if(myform.mouse.value == 'onmousescroll') sum++;
if(myform.cikl.value == '3') sum++;
if(myform.obr.value == '3') sum++;
if(myform.break.value == '2') sum++;
if(myform.click_mouse.value == '3') sum++;
if(myform.func.value == '4') sum++;
if(myform.script.value == '3') sum++;
alert('У Вас ' + sum + ' правильных ответа! Окно будет закрыто');
javascript:close();
};
</script>
</body>
</html> |