Skip to content

Commit 75cc347

Browse files
Merge branch 'javascript-tutorial:master' into master
2 parents 4ee42f4 + 1f10233 commit 75cc347

File tree

1 file changed

+32
-39
lines changed
  • 1-js/02-first-steps/06-alert-prompt-confirm

1 file changed

+32
-39
lines changed
Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,98 @@
11
# Interaction: alert, prompt, confirm
2-
3-
As we'll be using the browser as our demo environment, let's see a couple of functions to interact with the user: `alert`, `prompt` and `confirm`.
2+
ബ്രൗസർ നമ്മൾ ഒരു Demo environment ആയി ഉപയോഗിക്കുന്നതിനാൽ,user-നോട് interact ചെയ്യാൻ കുറച്ച് functions നോക്കാം: `alert`, `prompt`, പിന്നെ `confirm`.
43

54
## alert
65

7-
This one we've seen already. It shows a message and waits for the user to press "OK".
6+
ഇത് നമ്മൾ ഇതിനകം തന്നെ കണ്ടിട്ടുണ്ട്. ഇത് ഒരു alert കാണിക്കുകയും user "OK" അമർത്തുന്നതിനായി കാത്തിരിക്കുകയും ചെയ്യുന്നു.
87

9-
For example:
8+
ഉദാഹരണത്തിന്:
109

1110
```js run
1211
alert("Hello");
1312
```
1413

15-
The mini-window with the message is called a *modal window*. The word "modal" means that the visitor can't interact with the rest of the page, press other buttons, etc, until they have dealt with the window. In this case -- until they press "OK".
14+
alertനോട് കൂടെയുള്ള മിനി-വിൻഡോയെ *modal window* എന്ന് വിളിക്കുന്നു . "modal" എന്ന വാക്കിന്റെ അർത്ഥം, വിൻഡോ കൈകാര്യം ചെയ്യുന്നതുവരെ user ന് പേജിന്റെ ബാക്കി ഭാഗങ്ങളുമായി സംവദിക്കുക, മറ്റ് ബട്ടണുകൾ അമർത്തുക, മുതലായവ പറ്റില്ല. അതായത് 'OK' ഞെക്കുന്നത് വരെ.
1615

1716
## prompt
1817

19-
The function `prompt` accepts two arguments:
18+
Function `prompt` രണ്ട് arguments സ്വീകരിക്കുന്നു:
2019

2120
```js no-beautify
2221
result = prompt(title, [default]);
2322
```
2423

25-
It shows a modal window with a text message, an input field for the visitor, and the buttons OK/Cancel.
24+
ഇത് ഒരു text message ഉം സന്ദർശകനുള്ള ഇൻപുട്ട് ഫീൽഡും OK/Cancel ബട്ടണുകളും ഉള്ള ഒരു modal window കാണിക്കുന്നു.
2625

2726
`title`
28-
: The text to show the visitor.
27+
: സന്ദർശകനെ കാണിക്കാനുള്ള text.
2928

3029
`default`
31-
: An optional second parameter, the initial value for the input field.
30+
: ഒരു optional second parameter, ഇൻപുട്ട് ഫീൽഡിന്റെ initial value.
3231

33-
```smart header="The square brackets in syntax `[...]`"
34-
The square brackets around `default` in the syntax above denote that the parameter is optional, not required.
32+
```smart header="syntax ഇൽ ഉള്ള square bracket `[...]`"
33+
മുകളിലുള്ള syntax ന്റെ `default` ന് ചുറ്റുമുള്ള square ബ്രാക്കറ്റുകൾ, parameter ഓപ്ഷണൽ ആണെന്ന് സൂചിപ്പിക്കുന്നു,നമുക്ക് വേണമെങ്കിൽ മതി.ഇതിന്റെ ആവശ്യമില്ല.
3534
```
3635
37-
The visitor can type something in the prompt input field and press OK. Then we get that text in the `result`. Or they can cancel the input by pressing Cancel or hitting the `key:Esc` key, then we get `null` as the `result`.
38-
39-
The call to `prompt` returns the text from the input field or `null` if the input was canceled.
36+
User ന് prompt ഇൻപുട്ട് ഫീൽഡിൽ എന്തെങ്കിലും ടൈപ്പ് ചെയ്ത് OK അമർത്താം. അപ്പോൾ ആ text നമുക്ക് `result` ൽ ലഭിക്കും. Cancel അമർത്തുന്നതിലൂടെ അവർക്ക് ഇൻപുട്ട് cancel ചെയ്യാനും പറ്റും, `key:Esc` കീ അമർത്തുന്നതിലൂടെ, നമുക്ക് `result`ൽ `null` ലഭിക്കും.
4037
41-
For instance:
38+
`prompt` ലേക്കുള്ള കോൾ, ഇൻപുട്ട് ഫീൽഡിൽ നിന്ന് text return ചെയ്യും. ഇൻപുട്ട് cancel ആക്കുകയാണെങ്കിൽ `null` return ചെയ്യും.
39+
ഉദാഹരണത്തിന്:
4240
4341
```js run
4442
let age = prompt('How old are you?', 100);
4543
4644
alert(`You are ${age} years old!`); // You are 100 years old!
4745
```
4846

49-
````warn header="In IE: always supply a `default`"
50-
The second parameter is optional, but if we don't supply it, Internet Explorer will insert the text `"undefined"` into the prompt.
51-
52-
Run this code in Internet Explorer to see:
47+
````warn header="IE ൽ: എപ്പോഴും `default` കൊടുക്കുക"
48+
രണ്ടാമത്തെ parameter ഓപ്ഷണൽ ആണ്, പക്ഷേ നമ്മൾ അത് നൽകുന്നില്ലെങ്കിൽ, Internet Explorer `"undefined"` എന്ന് text promptൽ ചേർക്കും.
5349

50+
ഇത് കാണാൻ Internet Explorer(IE)ൽ ഈ കോഡ് run ചെയ്യുക:
5451
```js run
5552
let test = prompt("Test");
5653
```
5754

58-
So, for prompts to look good in IE, we recommend always providing the second argument:
59-
55+
അതിനാൽ, IE- ൽ നന്നായി കാണുന്നതിന്, രണ്ടാമത്തെ argument എല്ലായ്പ്പോഴും നൽകുക:
6056
```js run
61-
let test = prompt("Test", ''); // <-- for IE
57+
let test = prompt("Test", ''); // <-- IE
6258
```
6359
````
6460
6561
## confirm
6662
67-
The syntax:
63+
syntax:
6864
6965
```js
7066
result = confirm(question);
7167
```
7268
73-
The function `confirm` shows a modal window with a `question` and two buttons: OK and Cancel.
74-
75-
The result is `true` if OK is pressed and `false` otherwise.
76-
77-
For example:
69+
`confirm` function ൽ, ഒരു ചോദ്യവും, OK and Cancel ഉള്ള രണ്ട് ബട്ടണുകളും ഒരു modal വിൻഡോയും ആണ് കാണുന്നത്.
70+
OK അമർത്തിയാൽ `true` കിട്ടും, അല്ലാത്തപക്ഷം`false`.
71+
ഉദാഹരണത്തിന്:
7872
7973
```js run
8074
let isBoss = confirm("Are you the boss?");
8175
8276
alert( isBoss ); // true if OK is pressed
8377
```
8478
85-
## Summary
79+
## സംഗ്രഹം
8680
87-
We covered 3 browser-specific functions to interact with visitors:
81+
സന്ദർശകരുമായി സംവദിക്കാൻ ഞങ്ങൾ 3 browser-specific പ്രവർത്തനങ്ങൾ ഉൾപ്പെടുത്തി:
8882
8983
`alert`
90-
: shows a message.
84+
: ഒരു സന്ദേശം കാണിക്കുന്നു.
9185
9286
`prompt`
93-
: shows a message asking the user to input text. It returns the text or, if Cancel button or `key:Esc` is clicked, `null`.
87+
: ടെക്സ്റ്റ് ഇൻപുട്ട് ചെയ്യാൻ ഉപയോക്താവിനോട് ആവശ്യപ്പെടുന്ന ഒരു സന്ദേശം കാണിക്കുന്നു. ഇത് text return നൽകുന്നു അല്ലെങ്കിൽ, Cancel ബട്ടൺ, `key: Esc` ക്ലിക്ക് ചെയ്തിട്ടുണ്ടെങ്കിൽ,` null` return ചെയ്യും.
9488
9589
`confirm`
96-
: shows a message and waits for the user to press "OK" or "Cancel". It returns `true` for OK and `false` for Cancel/`key:Esc`.
97-
98-
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.
90+
: ഒരു സന്ദേശം കാണിക്കുകയും ഉപയോക്താവ് "OK" അല്ലെങ്കിൽ "Cancel" അമർത്തുന്നതിനായി കാത്തിരിക്കുകയും ചെയ്യുന്നു.ഇത് OK എന്നതിന് `true`, Cancel/`key:Esc` എന്നതിന് `false` എന്നിവ നൽകുന്നു.
9991
100-
There are two limitations shared by all the methods above:
92+
ഈ രീതികളെല്ലാം modal ആണ്: അവർ സ്ക്രിപ്റ്റ് execution താൽക്കാലികമായി നിർത്തി, വിൻഡോ dismiss ചെയ്യുന്നതുവരെ സന്ദർശകനെ ബാക്കി പേജുമായി സംവദിക്കാൻ അനുവദിക്കുന്നില്ല.
10193
102-
1. The exact location of the modal window is determined by the browser. Usually, it's in the center.
103-
2. The exact look of the window also depends on the browser. We can't modify it.
94+
മുകളിലുള്ള എല്ലാ രീതികളിലും common ആയി രണ്ട് പരിമിതികളുണ്ട്:
95+
1. modal വിൻഡോയുടെ കൃത്യമായ സ്ഥാനം ബ്രൗസർ നിർണ്ണയിക്കുന്നു. സാധാരണയായി, അത് നടുവിലായിട്ടാണ്.
96+
2. വിൻഡോയുടെ കൃത്യമായ രൂപവും ബ്രൗസറിനെ ആശ്രയിച്ചിരിക്കുന്നു. നമ്മൾക്ക് അത് modify ചെയ്യാൻ കഴിയില്ല.
10497
105-
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.
98+
User മായി ഇടപെടലുകൾ കാണിക്കാൻ ഇതിലും നല്ല മറ്റ് വഴികളുണ്ട്, പക്ഷേ നിസാരമായ ഈ പരിമിതികൾ നമ്മൾ കാര്യമാക്കുന്നില്ലെങ്കിൽ, ഈ 3 രീതികൾ തന്നെ നമുക്ക് ധാരാളം.

0 commit comments

Comments
 (0)