• Send Us A Tip
  • Calling all Tech Writers
  • Advertise
Monday, August 3, 2026
  • Login
TechStory
  • News
  • Crypto
  • Gadgets
  • Memes
  • Gaming
  • Cars
  • AI
  • Startups
  • Markets
  • How to
No Result
View All Result
  • News
  • Crypto
  • Gadgets
  • Memes
  • Gaming
  • Cars
  • AI
  • Startups
  • Markets
  • How to
No Result
View All Result
TechStory
No Result
View All Result
Home How to

How to write JavaScript in HTML

by Arya Roy
June 24, 2021
in How to, Tech
Reading Time: 3 mins read
0
How to write JavaScript in HTML

Source: https://www.hackreactor.com/blog/what-is-javascript-used-for/

TwitterWhatsappLinkedin

JavaScript, also referred to as JS, is one of the client-side scripting languages that is usually used in web development to create modern and interactive web pages. The term “script” is used to refer to languages that are not inherently standalone in nature. In this case, it refers to the fact that JavaScript runs on the client machine.

You might also like

How To Play Split Screen Halo Campaign Evolved

The Ultimate Palworld Breeding Calculator Guide

The Story Behind Cerebras: The Startup That Decided GPUs Weren’t Enough

In other words, it can also be said that the term “scripting” is used for languages that need the support of another language to get executed. For example, JavaScript programs will not get executed without the help of HTML or if they are integrated into an HTML code.

JavaScript is used in a wide range of ways when it comes to web pages, such as build image galleries, generating warning messages, manipulation of DOM, form validation, etc.

Users can easily add JavaScript to HTML pages using an embedding code. In order to add JavaScript code into the HTML pages, use the <script>…..</script> tag of the HTML that gets wrapped around JavaScript code while inside the HTML program.

Users can also define JavaScript code in either the <body> tag – also known as body tag – or <head> tag owing to the fact that it entirely depends on the structure of the web page that the users decide to use.

This can be understood more clearly with the help of an example of adding JavaScript to HTML, as shown below.

Input: 

<!DOCTYPE html >

<html>

<head>

<title> page title</title>

<script>

document.write(“Welcome to Javatpoint”);

</script>

</head>

<body>

<p>Inthis example we saw how to add JavaScript in the head section </p>

</body>

</html>

Output: 

Source: https://www.javatpoint.com/how-to-add-javascript-to-html

As mentioned above, you can also define the JavaScript code in the <body> tags or body section.

Input:

<!DOCTYPE html >

<html>

<head>

<title> page title</title>

</head>

<body>

<script>

document.write(“Welcome to Javatpoint”);

</script>

<p> In this example we saw how to add  JavaScript in the body section </p>

</body>

</html>

Output:

Source: https://www.javatpoint.com/how-to-add-javascript-to-html
Tags: HTMLJavaScript
Tweet55SendShare15
Previous Post

Embark Trucks goes Public!

Next Post

Cheapest Space Flight offered by Space Perspective at $125K per person

Arya Roy

Hi, this is Arya! Writing has always been a passion of mine, regardless of the topic I choose. Besides that, I am a huge foodie and music lover, whose interests range from world politics to horror films to everything in between.

Recommended For You

How To Play Split Screen Halo Campaign Evolved

by Khilav Jadav
August 2, 2026
0
How To Activate Skulls In Halo: Combat Evolved Campaign

Playing through a Halo campaign with a friend on the same couch is one of the most memorable gaming experiences ever created. If you want to know how...

Read more

The Ultimate Palworld Breeding Calculator Guide

by Khilav Jadav
August 2, 2026
0
How to Increase Inventory in Palworld

Breeding is one of the most rewarding systems in Palworld. It allows players to create stronger Pals, inherit valuable passive skills, and unlock creatures that may otherwise take...

Read more

The Story Behind Cerebras: The Startup That Decided GPUs Weren’t Enough

by Ishaan Negi
August 2, 2026
0
The Story Behind Cerebras: The Startup That Decided GPUs Weren’t Enough

For decades, the biggest breakthroughs in computing came from making chips smaller. Then one startup asked a completely different question: What if the future of AI required making...

Read more
Next Post
Cheapest Space Flight offered by Space Perspective at $125K per person

Cheapest Space Flight offered by Space Perspective at $125K per person

Please login to join discussion

Techstory

Tech and Business News from around the world. Follow along for latest in the world of Tech, AI, Crypto, EVs, Business Personalities and more.
reach us at info@techstory.in

Advertise With Us

Reach out at - info@techstory.in

Aviator Game India 2026

BROWSE BY TAG

#Crypto #howto 2024 acquisition AI amazon Apple Artificial Intelligence bitcoin Business China cryptocurrency e-commerce electric vehicles Elon Musk Ethereum facebook funding Gaming Google India Instagram Investment ios iPhone IPO Market Markets Meta Microsoft News OpenAI samsung Social Media SpaceX startup startups tech technology Tesla TikTok trend trending twitter US

© 2025 Techstory.in

No Result
View All Result
  • News
  • Crypto
  • Gadgets
  • Memes
  • Gaming
  • Cars
  • AI
  • Startups
  • Markets
  • How to

© 2025 Techstory.in

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?