5digit commited on
Commit
743b52d
·
verified ·
1 Parent(s): 1aeb3db

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +87 -18
index.html CHANGED
@@ -1,19 +1,88 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Конвертер размеров обуви</title>
7
+ <style>
8
+ body { font-family: Arial, sans-serif; }
9
+ .container { max-width: 600px; margin: auto; padding: 20px; }
10
+ input, select { width: 100%; margin: 10px 0; padding: 10px; }
11
+ .result { margin-top: 20px; }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <div class="container">
16
+ <h1>Конвертер размеров обуви</h1>
17
+ <input type="number" id="value" placeholder="Введите значение" />
18
+ <select id="unitFrom">
19
+ <option value="mm">Длина стопы в миллиметрах</option>
20
+ <option value="cm">Длина стопы в сантиметрах</option>
21
+ <option value="in">Длина стопы в дюймах</option>
22
+ <option value="mm_last">Длина колодки в миллиметрах</option>
23
+ <option value="cm_last">Длина колодки в сантиметрах</option>
24
+ <option value="in_last">Длина колодки в дюймах</option>
25
+ </select>
26
+ <button onclick="convert()">Перевести</button>
27
+
28
+ <div class="result" id="result"></div>
29
+ </div>
30
+
31
+ <script>
32
+ function convert() {
33
+ const value = parseFloat(document.getElementById('value').value);
34
+ const unitFrom = document.getElementById('unitFrom').value;
35
+ const resultDiv = document.getElementById('result');
36
+
37
+ if (isNaN(value)) {
38
+ resultDiv.innerHTML = "Пожалуйста, введите корректное значение.";
39
+ return;
40
+ }
41
+
42
+ // Переменные для хранения результатов
43
+ let mm, cm, inInches;
44
+
45
+ // Конвертация входного значения в миллиметры
46
+ if (unitFrom === 'mm') {
47
+ mm = value;
48
+ cm = value / 10;
49
+ inInches = value / 25.4;
50
+ } else if (unitFrom === 'cm') {
51
+ mm = value * 10;
52
+ cm = value;
53
+ inInches = value / 2.54;
54
+ } else if (unitFrom === 'in') {
55
+ mm = value * 25.4;
56
+ cm = value * 2.54;
57
+ inInches = value;
58
+ } else if (unitFrom === 'mm_last') {
59
+ mm = value;
60
+ cm = value / 10;
61
+ inInches = value / 25.4;
62
+ } else if (unitFrom === 'cm_last') {
63
+ mm = value * 10;
64
+ cm = value;
65
+ inInches = value / 2.54;
66
+ } else if (unitFrom === 'in_last') {
67
+ mm = value * 25.4;
68
+ cm = value * 2.54;
69
+ inInches = value;
70
+ }
71
+
72
+ // Формирование вывода
73
+ resultDiv.innerHTML = `
74
+ <strong>Результаты:</strong><br>
75
+ Длина стопы:<br>
76
+ ${mm.toFixed(4)} мм<br>
77
+ ${cm.toFixed(4)} см<br>
78
+ ${inInches.toFixed(4)} дюймов<br>
79
+ <br>
80
+ Длина колодки:<br>
81
+ ${mm.toFixed(4)} мм<br>
82
+ ${cm.toFixed(4)} см<br>
83
+ ${inInches.toFixed(4)} дюймов
84
+ `;
85
+ }
86
+ </script>
87
+ </body>
88
  </html>