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
Copy file name to clipboardExpand all lines: 1-js/2-first-steps/11-uibasic/article.md
+17-18Lines changed: 17 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ Run this code in Internet Explorer to see that:
60
60
var test =prompt("Test");
61
61
```
62
62
63
-
So, for IE looking good, it's recommended to always provide the second argument:
63
+
So, to look good in IE, it's recommended to always provide the second argument:
64
64
65
65
```js
66
66
//+ run
@@ -77,34 +77,33 @@ var test = prompt("Test", ''); // <-- for IE
77
77
result =confirm(question);
78
78
```
79
79
80
-
`confirm`выводит окно с вопросом `question`с двумя кнопками: OK и CANCEL.
80
+
Function `confirm`shows a modal window with a `question`and two buttons: OK and CANCEL.
81
81
82
-
**Результатом будет `true`при нажатии OK и `false`- при CANCEL([key Esc]).**
82
+
The result is `true`if OK is pressed and `false`otherwise.
83
83
84
-
Например:
84
+
For example:
85
85
86
86
```js
87
87
//+ run
88
-
varisAdmin=confirm("Вы - администратор?");
88
+
varisBoss=confirm("Are you the boss?");
89
89
90
-
alert( isAdmin );
90
+
alert( isBoss );// true is OK is pressed
91
91
```
92
92
93
-
## Особенности встроенных функций
93
+
## The limitations
94
94
95
-
Конкретное место, где выводится модальное окно с вопросом -- обычно это центр браузера, и внешний вид окна выбирает браузер. Разработчик не может на это влиять.
95
+
There are two limitations shared by all the methods:
96
+
<ol>
97
+
<li>The exact location of the modal window is determined by the browser. Usually it's in the center.</li>
98
+
<li>The exact look of the window also depends on the browser. We can't modify it.</li>
99
+
</ol>
96
100
97
-
С одной стороны -- это недостаток, так как нельзя вывести окно в своем, особо красивом, дизайне.
101
+
That is the price for simplicity. There are other means to show windows and interact with the visitor, but if the "bells and whistles" do not matter much, these methods are just fine.
98
102
99
-
С другой стороны, преимущество этих функций по сравнению с другими, более сложными методами взаимодействия, которые мы изучим в дальнейшем -- как раз в том, что они очень просты.
100
-
101
-
Это самый простой способ вывести сообщение или получить информацию от посетителя. Поэтому их используют в тех случаях, когда простота важна, а всякие "красивости" особой роли не играют.
102
-
103
-
104
-
## Резюме
103
+
## Summary
105
104
106
105
<ul>
107
-
<li>`alert` выводит сообщение.</li>
108
-
<li>`prompt` выводит сообщение и ждёт, пока пользователь введёт текст, а затем возвращает введённое значение или `null`, если ввод отменён (CANCEL/[key Esc]).</li>
109
-
<li>`confirm` выводит сообщение и ждёт, пока пользователь нажмёт "OK" или "CANCEL" и возвращает `true/false`.</li>
106
+
<li>`alert` shows a message.</li>
107
+
<li>`prompt` shows a message asking the user to input text. It returns the text or, if CANCEL or [key Esc] is clicked, all browsers except Safari return `null`.</li>
108
+
<li>`confirm` shows a message and waits the user to press "OK" or "CANCEL". It returns `true` for OK and `false` for CANCEL/[key Esc].</li>
0 commit comments