You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, for prompts to look good in IE, we recommend always providing the second argument:
63
+
Для более лаконичного отображения, реккомендуется всегда указывать второй параметр:
64
64
65
65
```js run
66
-
let test = prompt("Test", ''); // <-- for IE
66
+
let test = prompt("Test", ''); // <-- для IE
67
67
```
68
68
````
69
69
70
70
## confirm
71
71
72
-
The syntax:
72
+
Синтаксис:
73
73
74
74
```js
75
75
result =confirm(question);
76
76
```
77
77
78
-
The function `confirm`shows a modal window with a`question`and two buttons: OK and CANCEL.
78
+
Функция `confirm`отображает модальное окно с текстом вопроса`question`и двумя кнопками: OK и CANCEL.
79
79
80
-
The result is `true`if OK is pressed and`false` otherwise.
80
+
Результат `true`если нажата кнопка OK. В других случаях`false`.
81
81
82
-
For example:
82
+
Например:
83
83
84
84
```js run
85
-
let isBoss =confirm("Are you the boss?");
85
+
let isBoss =confirm("Ты тут главный?");
86
86
87
-
alert( isBoss ); // true if OK is pressed
87
+
alert( isBoss ); //`true` если нажата OK
88
88
```
89
89
90
-
## Summary
90
+
## Резюме
91
91
92
-
We covered 3 browser-specific functions to interact with visitors:
92
+
Рассмотрели 3 функции браузера для взаимодействия с пользователем:
93
93
94
94
`alert`
95
-
: shows a message.
95
+
: показывает сообщение.
96
96
97
97
`prompt`
98
-
: shows a message asking the user to input text. It returns the text or, if CANCEL or `key:Esc` is clicked, `null`.
98
+
: показывает сообщение и запрашивает ввод текста от пользователя. Возвращает напечатанный текст в поле ввода или `null` если были нажаты кнопки CANCEL или `Esc` с клавиатуры.
99
99
100
100
`confirm`
101
-
: shows a message and waits for the user to press "OK" or "CANCEL". It returns `true`for OK and`false`for CANCEL/`key:Esc`.
101
+
: показывает сообщение и ждет пока пользователь нажмет OK или CANCEL. Возращает `true`если нажата OK и`false`если нажаты кнопки CANCEL или `Esc` с клавиатуры.
102
102
103
-
All these methods are modal: they pause script execution and don't allow the visitor to interact with the rest of the page until the window has been dismissed.
103
+
Все эти методы являются модальными: останавливают выполнение скриптов и не позволяют пользователю взаимодействовать с остальной частью страницы до тех пор, пока окно не будет закрыто.
104
104
105
-
There are two limitations shared by all the methods above:
105
+
На все указанные методы распространяется два ограничения:
106
106
107
-
1.The exact location of the modal window is determined by the browser. Usually, it's in the center.
108
-
2.The exact look of the window also depends on the browser. We can't modify it.
107
+
1.Расположение окон определяется браузеров. Обычно окна рассположены в центре.
108
+
2.Визуальное отображение окон зависит от браузера и мы не можем изменит их вид.
109
109
110
-
That is the price for simplicity. There are other ways to show nicer windows and richer interaction with the visitor, but if "bells and whistles" do not matter much, these methods work just fine.
110
+
Такова цена простоты. Есть другие способы показать более приятные глазу окна с богатым функционалом для взаимодействия с пользователем, но если "навороты" не имеют значеня, то данные методы работают отлично.
0 commit comments