HTML: Hypertext Markup Language (JavaScript For Beginners)

Adding JavaScript to HTML Document - Easy way to start

If you are slightly interested in web Development or Coding, you must have heard the name JavaScript. You may have also used JavaScript.

In today's article, we will tell you what JavaScript is, the history of JavaScript, its features, uses, advantages, and disadvantages, how to enable JavaScript and how JavaScript is different from Java. 

I will give all the information in easy words so that it will be easy for you to learn JavaScript.

To become a web designer, it is also essential to know Java and JavaScript along with HTML and CSS; then, only you can create an attractive and user-friendly webpage or website.

JavaScript For Beginners

So stay with us in this article until the end and know what JavaScript is from the beginning.

Example: For you, we have created a small javascript project with style-element; which shows the Date and Time ( click on the below button for the result )


{tocify} $title={Table of Contents}

The HTML <script> Tag

The HTML <script> tag is utilized to determine a client-side script (JavaScript).

The <script> element either holds script statements or it points to an external script file via the src attribute.

  • Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.

To choose an HTML element, JavaScript most often utilizes the document.getElementById() method.

  • This JavaScript example writes "Hey JavaScript!" into an HTML element with id= "my-demo":

Example:

<!DOCTYPE html>
<html>
<body>

<h2>Use JavaScript to Change Text</h2>

<p> Note: This example writes "Hey JavaScript!" into an HTML element with id= "my-demo":</p>

<p id="my-demo"></p>

<script>
document.getElementById("my-demo").innerHTML = "Hey JavaScript!";
</script> 

</body>
</html>{codeBox}

Taste of JavaScript

Here are some examples of what JavaScript can do:

Example:

JavaScript can change content:

document.getElementById("my-demo").innerHTML = "Hey JavaScript!";{codeBox}

Example:

JavaScript can change styles:

document.getElementById("my-demo").style.fontSize = "20px";
document.getElementById("my-demo").style.color = "green";
document.getElementById("my-demo").style.backgroundColor = "orange";{codeBox}

Example:

JavaScript can change attributes:

document.getElementById("image").src = "forest.gif";{codeBox}

Note: replace "forest.gif" with your own image link.{alertSuccess}

HTML: <noscript> tag

The HTML <noscript> tag represents an alternate content to be displayed to users that have disabled scripts in their browser or have a browser that doesn't support scripts:

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
document.getElementById("my-demo").innerHTML = "Hey JavaScript!";
</script>

<noscript>Sorry, your browser does not support JavaScript!</noscript>

<p>A browser without support for JavaScript will show the text written inside the noscript element.</p>
 
</body>
</html>{codeBox}

What is JavaScript?

JavaScript is a popular computer programming language, with the help of which HTML Web Pages can be made more interactive; it is a Powerful Scripting Language.

JavaScript supports almost all Web Browsers and Operating Systems. In today's time, nearly all big companies use JavaScript.

Dynamic Web Pages can be created through JavaScript. At the same time, it is used to build Mobile Applications, Web Applications, Games, etc.

Although the official name of JavaScript is ECMAscript, but people know it only by the name of JavaScript. JavaScript is a Lightweight Scripting Language.

  • JavaScript is a Client Side Scripting as well as Server Side Scripting. 

To understand JavaScript well, it is necessary to understand what Client Side and Server Side Scripting are, so before proceeding further in the article, we will know this.

What is Client-Side JavaScript:

Client Side Scripting is a script that runs on the user's browser. Users can see the Client Side JavaScript code on their browser because it runs on the browser.

What is Server-Side JavaScript:

Such script or programming which runs on the server and not on the browser is called Server Side Scripting. 

It can access Server's Files, Database. 

Users cannot see the code of Server Side Scripting on the browser because it resides in the server itself and is executed there.

Work of HTML, CSS, and JavaScript in Web Development

It is also essential to have knowledge of JavaScript, HTML, and CSS in web development. These three languages have different functions in creating a web page.

  • HTML prepares the structure of a Web Page.
  • The web page is designed with CSS.
  • Web Page is made Interactive by JavaScript, such as Navigation, Event, etc.

JavaScript History

JavaScript was invented in 1995 by programmer Brendon Eich of Netscape Communication Corporation. It took ten days to make JavaScript.

Initially, JavaScript was named Mocha, and later, it was changed to LiveScript. And finally, this programming language was called JavaScript. 

The official name of JavaScript was given ECMAscript, but people knew it only by the name of JavaScript.

First of all, JavaScript was used in Netscape Browser Version 2.0B3 in December 1995; today, almost the world's biggest websites, Facebook, and Google, also use JavaScript.

Version of JavaScript

All the versions of JavaScript so far are as follows -

JavaScript VersionRelease Year
JavaScript 1 (ES1)1997
JavaScript 2 (ES2)1998
JavaScript 3 (ES3)1999
JavaScript 4 (ES4)Never Released
JavaScript 5 (ES5)2009
JavaScript 6 (ES6)2015
JavaScript 7 (ES7)2016
JavaScript 8 (ES8)2017
JavaScript 9 (ES9)2018

Feature of JavaScript

Let's explore the key features of JavaScript; Some of these features are as follows -

  • JavaScript can be run in any web browser without being compiled.
  • It is an Object Oriented Language, but the method of handling Objects in it is different from pure Objects Oriented languages like Java and C++.
  • A dynamic web page can be created with the help of JavaScript.
  • JavaScript is a Case Sensitive Programming Language.
  • It is a Lightweight Scripting Language.
  • JavaScript supports almost all Web Browsers and Operating Systems.
  • Text, Image, Table, Link, etc., can be added after Event Occurrence in JavaScript.
  • Unlike other programming languages, JavaScript has functions to set the date and time.
  • The execution of JavaScript is very fast because it executes on the Client Side.
  • JavaScript is used in ClientSide as well as Server Side.

Uses of JavaScript

JavaScript is a popular language used in many works today; let us know where JavaScript is used:

  • JavaScript is widely used in web development. With its help, you can make the website User Friendly by creating many elements like Navigation, Image Slider, Pop Up Window, etc.
  • Web applications are also made with the help of JavaScript.
  • Mobile applications are also made with the help of JavaScript.
  • Javascript is also used generously in making Web Server.
  • JavaScript is also used in making games.
  • You can also use JavaScript to determine which browser the user uses.

Apart from all this, there are many areas where JavaScript is used, such as in creating Server Applications. But these are essential areas where JavaScript is used more.

Advantage of JavaScript

There are many advantages of JavaScript, some of which are as follows –

1. Easy to learn – JavaScript language is easy to understand. Because Code Syntax is very simple in this.

2. Speed – Due to being ClientSide, the speed of JavaScript is fast.

3. Server Load – The JavaScript script is written for ClientSide, which is executed by the browser on the user's device, which reduces Server Requests.

4. JavaScript supports almost all types of Operating Systems and Browsers.

5. With the help of JavaScript, you can create Event Based Program, which means that such programs are executed on a particular event.

6. JavaScript can be mixed with any other programming language or script and can be inserted into any file.

7. With JavaScript, a website can be made Interactive and Attractive.

Disadvantage of JavaScript

On the one hand, there are many advantages of JavaScript; on the other hand, it also has some disadvantages –

1. Being ClientSide, JavaScript is not considered a more secure language because it is executed on the Client's Browser.

2. JavaScript works differently on different browsers, so its outputs are different on other platforms.

Difference Between Java and JavaScript

Many people need clarification on Java and JavaScript. Some consider it the same language, but it is entirely wrong. 

Java and JavaScript are both different languages. The differences between them are as follows -

  • JavaScript is a Scripting Programming Language that is used in HTML Pages. At the same time, Java is a Real Programming Language that is used entirely in other works.
  • JavaScript is a Week Typing Language, while Java is a Strong Typing Language.
  • Java is a High-Level Programming Language; once typed, it can be run in any browser, while JavaScript is a Client Side Programming Language that can be executed directly in the user's browser.
  • Java can be difficult to learn as compared to JavaScript.

Conclusion:

Friends, according to my expertise, I have written complete information to help you with "HTML JavaScript." If this post is favourable for you or not, please tell me by commenting.

If you liked this post, remember to share it with your friends so they can get information about it.

You can ask us through comments if you still have questions or doubts, I will answer all your questions, and you can contact us for more information.

Please tell us through the comment section if you think we miss anything.


Post a Comment

If you have any problem please feel free to contact us by - AKASH TIMES

Previous Next

نموذج الاتصال