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/02-first-steps/01-hello-world/2-hello-alert-ext/task.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,8 @@ importance: 5
2
2
3
3
---
4
4
5
-
# Show an alert with an external script
5
+
# বাহিরের একটি স্ক্রিপ্ট দিয়ে একটি এলার্ট দেখাও
6
6
7
-
Take the solution of the previous task <info:task/hello-alert>. Modify it by extracting the script content into an external file `alert.js`, residing in the same folder.
7
+
পূর্ববর্তী কাজের সমাধানটি নাও। <info:task/hello-alert>. একই ফোল্ডারে একটি আলাদা `alert.js ফাইলে কোডটি রাখো।
This part of the tutorial is about core JavaScript, the language itself.
3
+
এই টিউটোরিয়াল অংশটি মুলত জাভাস্ক্রিপ্ট প্রোগ্রামিং ভাষার মূল বিষয় সমূহ নিয়ে।
4
4
5
-
But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui)of the tutorial.
5
+
কিন্তু আমাদের স্ক্রিপ্টগুলো চালানোর জন্য একটি কাজের পরিবেশ দরকার এবং যেহেতু এই বইটি অনলাইনে রয়েছে, তাই ব্রাউজার একটি ভাল পছন্দ হবে। আমরা ব্রাউজার-নির্দিষ্ট কমান্ড গুলো (যেমনঃ `এলার্ট`) সর্বনিম্ন পরিমান রাখবো যাতে করে এতে আপনাদের সময় নষ্ট না হয়, যদি আপনারা অন্য পরিবেশে মনোনিবেশ করার পরিকল্পনা করে থাকেন(যেমনঃ Node.js)। আমরা এই টিউটরিয়ালের [পরবর্তী অংশে](/ui) ব্রাউজারে জাভাস্ক্রিপ্ট উপর গুরুত্ব দিব।
6
6
7
-
So first, let's see how we attach a script to a webpage. For server-side environments (like Node.js), you can execute the script with a command like `"node my.js"`.
7
+
তাই প্রথমে, চলুন আমরা দেখি কিভাবে ওয়েবপেজে একটি স্ক্রিপ্ট সংযুক্ত করে। সার্ভার-সাইড পরিবেশ গুলোর জন্য (যেমনঃ Node.js), আপনি একটা কমান্ড দিয়ে স্ক্রিপ্ট চালাতে পারবেন `"node my.js"` এর মত করে।
8
8
9
9
10
-
## The "script" tag
10
+
## "script" ট্যাগ
11
11
12
-
JavaScript programs can be inserted into any part of an HTML document with the help of the `<script>`tag.
12
+
জাভাস্ক্রিপ্ট এর কার্যক্রম গুলো এইচটিএমএল ডকুমেন্টের যেকোনো অংশে রাখা যেতে পারে `<script>`ট্যাগের সাহায্য নিয়ে।
13
13
14
-
For instance:
14
+
উদাহরণস্বরূপ:
15
15
16
16
```html run height=100
17
17
<!DOCTYPE HTML>
18
18
<html>
19
19
20
20
<body>
21
21
22
-
<p>Before the script...</p>
22
+
<p>স্ক্রিপ্টের আগে...</p>
23
23
24
24
*!*
25
25
<script>
26
-
alert( 'Hello, world!' );
26
+
alert( 'হ্যালো, বিশ্ব!' );
27
27
</script>
28
28
*/!*
29
29
30
-
<p>...After the script.</p>
30
+
<p>...স্ক্রিপ্টের পরে.</p>
31
31
32
32
</body>
33
33
34
34
</html>
35
35
```
36
36
37
37
```online
38
-
You can run the example by clicking the "Play" button in the right-top corner of the box above.
38
+
বক্সের উপরের ডান পাশের মাথায় "প্লে" বাটনের ক্লিক করে আপনি উদাহরণটি চালিয়ে দেখতে পারেন।
39
39
```
40
40
41
-
The `<script>`tag contains JavaScript code which is automatically executed when the browser processes the tag.
41
+
`<script>`ট্যাগটি জাভাস্ক্রিপ্ট কোড ধারন করে যেটাকে স্বয়ংক্রিয়ভাবে কার্যকর করা হয় যখন ব্রাউজার ট্যাগটি প্রসেস করে।
42
42
43
43
44
-
## Modern markup
44
+
## আধুনিক মার্কআপ
45
45
46
-
The `<script>`tag has a few attributes that are rarely used nowadays but can still be found in old code:
46
+
`<script>`ট্যাগে কয়েকটি এট্রিবিউট রয়েছে যেটা আজকাল খুব কম ব্যবহার করা হয় কিন্তু কিছু পুরনো কোডে এখনও এইগুলো পাওয়া যেতে পারে:
47
47
48
-
The `type`attribute: <code><script <u>type</u>=...></code>
49
-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic; we'll talk about modules in another part of the tutorial.
: পুরানো এইচটিএমএল স্ট্যান্ডার্ড, এইচটিএমএল ৪ এ একটি স্ক্রিপ্টে `type` এট্রিবিউটটি থাকা আবশ্যক ছিল। সাধারনত এটা ছিল `type="text/javascript"`। এটি আর প্রয়োজন হয় না। আরও বলতে গেলে, আধুনিক এইচটিএমএল স্ট্যান্ডার্ড এ পুরোপুরিভাবে এট্রিবিউটসের অর্থই বদলে দিয়েছে। এখন, এটা জাভাস্ক্রিপ্ট মডিউলস এর জন্য ব্যবহার করা যেতে পারে। কিন্তু এটা একটি অ্যাডভান্সড বিষয়, আমরা মডিউলস সম্পর্কে টিউটরিয়ালের অন্য অংশে কথা বলব।
50
50
51
-
The `language`attribute: <code><script <u>language</u>=...></code>
52
-
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
: এই এট্রিবিউটটি স্ক্রিপ্টের ভাষা দেখানোর জন্য বুঝানো হয়েছে। এই এট্রিবিউটটি দিয়ে এখন আর কিছু হয় না কারন জাভাস্ক্রিপ্টই এখন ডিফল্ট ভাষা। এটা ব্যবহার করার এখন আর প্রয়োজন নেই।
53
53
54
-
Comments before and after scripts.
55
-
: In really ancient books and guides, you may find comments inside `<script>`tags, like this:
54
+
স্ক্রিপ্টগুলির আগে এবং পরে মন্তব্যগুলিঃ
55
+
সত্যিই পুরনো বই এবং গাইডগুলিতে, আপনারা হয়তো `<script>`ট্যাগগুলোর মধ্যে মন্তব্যগুলি পেতে পারেন, এটার মতঃ
56
56
57
57
```html no-beautify
58
58
<script type="text/javascript"><!--
59
59
...
60
60
//--></script>
61
61
```
62
+
63
+
আধুনিক জাভাস্ক্রিপ্টে এই কৌশলটি আর ব্যবহার করা হয় না। এই মন্তব্যগুলি জাভাস্ক্রিপ্ট কোডগুলো কে লুকিয়ে রাখে পুরনো ব্রাউজার গুলো থেকে যারা জানে না কিভাবে `<script>` ট্যাগকে প্রসেস করতে হয়।
64
+
যেহেতু গত 15 বছরে প্রকাশিত ব্রাউজারগুলিতে এই সমস্যাটি নেই, এই জাতীয় মন্তব্য আপনাকে অনেক পুরানো কোড সনাক্ত করতে সহায়তা করতে পারে।
62
65
63
-
This trick isn't used in modern JavaScript. These comments hide JavaScript code from old browsers that didn't know how to process the `<script>` tag. Since browsers released in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
66
+
## এক্সটার্নাল স্ক্রিপ্ট
64
67
68
+
যদি আমাদের অনেক জাভাস্ক্রিপ্ট কোড থাকে, তাহলে আমরা এইগুলোকে আলাদা ফাইলে রাখতে পারি।
65
69
66
-
## External scripts
67
-
68
-
If we have a lot of JavaScript code, we can put it into a separate file.
69
-
70
-
Script files are attached to HTML with the `src` attribute:
70
+
স্ক্রিপ্ট ফাইল গুলো এইচটিএমএল এ সংযুক্ত করা হয় `src` এট্রিবিউট দিয়েঃ
71
71
72
72
```html
73
73
<scriptsrc="/path/to/script.js"></script>
74
74
```
75
75
76
-
Here, `/path/to/script.js`is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"`would mean a file `"script.js"`in the current folder.
76
+
এখানে, `/path/to/script.js`এই পথটি হয় সাইট এর মূল থেকে স্ক্রিপ্টের জন্য একটি সঠিক পথ। বর্তমান পৃষ্ঠা থেকে যে কেউ আপেক্ষিক পথ সরবরাহ করতে পারে. উদাহরণস্বরূপ, `src="script.js"`এই `"script.js"`ফাইল দিয়ে বর্তমান ফোল্ডার থেকে বুঝায়।
একটি একক`<script>`ট্যাগে কখনই একাধিক `src`এট্রিবিউট এবং ভিতরে কোড থাকতে পারে না।
104
104
105
-
This won't work:
105
+
এটা কাজ করবে না:
106
106
107
107
```html
108
108
<script*!*src*/!*="file.js">
109
109
alert(1); // the content is ignored, because src is set
110
110
</script>
111
111
```
112
112
113
-
We must choose either an external `<script src="…">`or a regular `<script>`with code.
113
+
আমাদের অবশই বাছাই করতে হবে হয় বহিরাগত `<script src="…">`অথবা স্বাভাবিক `<script>`ট্যাগ এর ভেতরে কোড।
114
114
115
-
The example above can be split into two scripts to work:
115
+
উপরের উদাহরণটি কাজ করাতে দুইটি স্ক্রিপ্টে বিভক্ত করা যেতে পারে।
116
116
117
117
```html
118
118
<scriptsrc="file.js"></script>
@@ -122,11 +122,11 @@ The example above can be split into two scripts to work:
122
122
```
123
123
````
124
124
125
-
## Summary
125
+
## সারাংশ
126
126
127
-
- We can use a `<script>` tag to add JavaScript code to a page.
128
-
- The `type` and `language` attributes are not required.
129
-
- A script in an external file can be inserted with `<script src="path/to/script.js"></script>`.
127
+
- আমরা একটি পেজে জাভাস্ক্রিপ্ট যোগ করতে `<script>` ট্যাগ ব্যবহার করতে পারি ।
128
+
- `type` এবং `language` এট্রিবিউটসের এখন আর প্রয়োজন নেই।
129
+
- আলাদা ফাইলের স্ক্রিপ্টগুলো `<script src="path/to/script.js"></script>` এইভাবে রাখা যেতে পারে।
130
130
131
131
132
-
There is much more to learn about browser scripts and their interaction with the webpage. But let's keep in mind that this part of the tutorial is devoted to the JavaScript language, so we shouldn't distract ourselves with browser-specific implementations of it. We'll be using the browser as a way to run JavaScript, which is very convenient for online reading, but only one of many.
132
+
ব্রাউজার স্ক্রিপ্ট এবং ওয়েবপেজের সাথে এদের ইন্টারেকশন সম্পর্কে অনেক কিছু শেখার আছে। তবে, মাথায় রাখা উচিত যে টিউটোরিয়ালটির এই অংশটি উৎসর্গ করা হয় জাভাস্ক্রিপ্ট ভাষার প্রতি, তাই এটির ব্রাউজার-নির্দিষ্ট বাস্তবায়ন দেখে আমাদের নিজেদেরকে বিভ্রান্ত করা উচিত হবে না। আমরা ব্রাউজার শুধু জাভাস্ক্রিপ্ট চালানোর জন্য ব্যবহার করবো, যেটা অনলাইনে পড়ার জন্য সহজ। কিন্তু এটি অনেকগুলি উপায়ের মধ্যে একটি।
0 commit comments