-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
45 lines (33 loc) · 1.14 KB
/
Copy pathtest.html
File metadata and controls
45 lines (33 loc) · 1.14 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Анкета</title>
</head>
<html>
<body>
<div id="result"> </div>
<input type="button" value='Жми!' onclick='test()'></input>
<script>
"use strict";
function getNumWord(num,word1,word2,word5) {
var dd=num%100;
if ( (dd>=11) && (dd <= 19) )
return word5;
var d=num%10;
if ( d==1 )
return word1;
if ( (d>=2) && (d<=4) )
return word2;
return word5;
}
function test() {
var applesS=prompt('Сколько у вас яблок?');
var apples=parseInt(applesS);
alert( 'У вас ' + getNumWord(apples,'яблоко','яблока','яблок') + '!' );
}
</script>
</body>
</html>