নিম্নলিখিত তিনটি উপায় রয়েছে যার মাধ্যমে আমরা HTML নথিতে জাভাস্ক্রিপ্ট কোড যোগ করতে পারি:
জাভাস্ক্রিপ্ট কোডটি
… ট্যাগে অন্তর্ভুক্ত করুন।
… ট্যাগ এবং বডি ট্যাগ বন্ধ হওয়ার পরে জাভাস্ক্রিপ্ট কোড অন্তর্ভুক্ত করুন।
HTML এ জাভাস্ক্রিপ্টের আলাদা ফাইল লিঙ্ক করুন
এই বিভাগে, আপনি
এবং ট্যাগের মধ্যে জাভাস্ক্রিপ্ট কোড অন্তর্ভুক্ত করতে শিখবেন।
বাক্য গঠন
- html>
- head>
- script>
- JavaScript Code
- Statement 1
- Statement 2
- ……
- Statement N
- script>
- head>
- body>
- body>
- html>
উপরের সিনট্যাক্সে, ট্যাগ রাখা হয়।
উদাহরণ
- !DOCTYPE html>
- html>
- head>
- meta name=“viewport” content=“width=device-width, initial-scale=1”>
- title>
- Include JavaScript in head tag
- title>
- <script>
- function check()
- {
- /* The following statement is used to display a Confirm dialog box on a webpage with the statement which is enclosed in the brackets. */
- confirm(“Your JavaScript Code Run”);
- }
- script>
- <style>
- /* The following tag selector button use the different properties for the Button. */
- button {
- background-color: red;
- padding: 16px 20px;
- margin: 8px 0;
- border: none;
- cursor: pointer;
- color: white;
- width: 100%;
- opacity: 0.9;
- }
- /* The following tag selector hover use the opacity property for the Button which select button when you mouse over it. */
- button:hover {
- opacity: 1;
- }
- style>
- head>
- <body>
- <form>
-
- <button type=“button” onclick=“check()”> Click Me for running a JavaScript Code button>
- form>
- body>
- html>
এই বিভাগে, আপনি
এবং ট্যাগের মধ্যে জাভাস্ক্রিপ্ট কোড কীভাবে অন্তর্ভুক্ত করবেন সে সম্পর্কে শিখবেন।
বাক্য গঠন
- <html>
- <head>
- head>
- <body>
-
- <script>
- JavaScript Code
- Statement 1
- Statement 2
- ……
- Statement N
- script>
- body>
- html>
উপরের সিনট্যাক্সে, ট্যাগটি HTML ফাইলে
এবং ট্যাগের মধ্যে রাখা হয়।
উদাহরণ
- >
- <html>
- <head>
- <meta name=“viewport” content=“width=device-width, initial-scale=1”>
- <title>
- Include JavaScript in body tag
- title>
- <style>
- /* The following tag selector button use the different properties for the Button. */
- button {
- background-color: red;
- padding: 16px 20px;
- margin: 8px 0;
- border: none;
- cursor: pointer;
- color: white;
- width: 100%;
- opacity: 0.9;
- }
- /* The following tag selector hover use the opacity property for the Button which select button when you mouse over it. */
- button:hover {
- opacity: 1;
- }
- style>
- head>
- <body>
- <form>
- <script>
- function bdy_JS ()
- {
- /* The following statement is used to display a Confirm dialog box on a webpage with the statement which is enclosed in the brackets. */
- confirm(“Your JavaScript Code Run which is used in the Body tag”);
- }
- script>
-
-
- <button type=“button” onclick=“bdy_JS()”> Click Me for running a JavaScript Code button>
- form>
- body>
- html>
এই বিভাগে, আপনি
ট্যাগের পরে JavaScript কোড অন্তর্ভুক্ত করতে শিখবেন।
বাক্য গঠন
- <html>
- <head>
- head>
- <body>
- body>
- <script>
- JavaScript Code
- Statement 1
- Statement 2
- ……
- Statement N
- script>
- html>
উপরের সিনট্যাক্সে, ট্যাগ বসানো হয়।
উদাহরণ:
- >
- <html>
- <head>
- <meta name=“viewport” content=“width=device-width, initial-scale=1”>
- <title>
- Include JavaScript code after the body tag
- title>
- <style>
- /* The following tag selector button use the different properties for the Button. */
- button {
- background-color: red;
- color: white;
- margin: 8px 0;
- border: none;
- cursor: pointer;
- width: 100%;
- padding: 16px 20px;
- opacity: 0.9;
- }
- /* The following tag selector hover use the opacity property for the Button which select button when you mouse over it. */
- button:hover {
- opacity: 1;
- }
- style>
- head>
- <body>
- <form>
-
- <button type=“button” onclick=“bdy_JS()”> Click Me for running a JavaScript Code button>
-
- form>
- body>
- <script>
- function bdy_JS ()
- {
- /* The following statement is used to display a Confirm dialog box on a webpage with the statement which is enclosed in the brackets. */
- confirm(“Your JavaScript Code Run which is used after the Body tag”);
- }
- script>
- html>
এই বিভাগে, আপনি HTML ফাইলে JavaScript কোডের ফাইল অন্তর্ভুক্ত করতে শিখবেন।
বাক্য গঠন
- <html>
- <head>
- <script src=”Name_of_JavaScript_file>
- script>
- head>
- <body>
- body>
- html>
উপরের সিনট্যাক্সে, src হল

Cookie Consent
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
Cookie Preferences
This cookie is used to store the user's cookie consent preferences.
30 days
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Marketing cookies are used to follow visitors to websites. The intention is to show ads that are relevant and engaging to the individual user.