Where are JavaScript web programming language commands located?
5 minute(s) read
|
Published on: Jun 03, 2021
Updated on: Dec 14, 2021
|
To be able to design a web application, you need to use a large number of programming languages; JS is the most popular among all the programming languages out there, and many programmers prefer to use it to achieve their desired goals, there are several commands in this language that need to be placed in the right place to be executed correctly, which we are going to discuss below, but before that, we need to get a little familiar with the language itself.
What is JavaScript?
It is one of the programming languages that is used to control the behavior of web pages along with other languages which are used for the basic structure of web pages. To turn the page into a page that users can interact with, this language can be used for different purposes, each of which is very important, and we need to focus more on learning them in programming. By mastering this language, it is possible to implement features that are very complex on the web.
There are JavaScript engines in various browsers, which are embedded by JS scripts and can be used to convert the script into a language that can be understood by different devices; the most important terms in the field of programming are Frontend Development and Backend Development, which we have explained in previous articles on this field.
Where are JavaScript-web programming language commands located?
Its commands in HTML code can be placed in 3 general places, which we will mention in the following.
1. Between the
... tag2. Between the
... tag3. In the external file with an extension ".js"
- Between the
... and ... tags:Consider the following example, which is another example of it.
- In the external file with an extension ".js":
Another place where you can enter JavaScript commands is to write them in an external file and then import them into an HTML file; now, consider the following example.
These commands can work in three ways when different codes enter them in HTML language.
- thisCan Change HTML Styles (CSS):
When this happens, the HTML attribute will change, so to understand it more, you need to consider the following example.
- this Can Hide HTML Elements:
Another thing that these commands can do on HTML elements is to hide them by displaying different elements.
- this Can Show HTML Elements:
Elements that are hidden can also be displayed.
In the above, we have mentioned the places where JS commands can be placed in general so that you can master the subject in a short while. Still, if you want to have more detailed information, we suggest you continue reading this article because other places will be mentioned below.
- between tags:
Here, the following example is given.
- JavaScript in :
To understand more about this, you need to pay attention to the following example.
- JavaScript in :
It may also be located as follows.
- External-JavaScript:
As we have mentioned at the beginning of the article, they may be located in external files, which an example will be given in the following. It should be noted that placing scripts in external files and then embedding them in HTML code causes these two types of code to be separate from each other; as a result, it makes it easier to maintain each of them as well as read them, in addition, saved JS files can speed up the loading of pages, which can be of great help to various programmers.
In general, it has a wide world and has many fans who use it to achieve their desires, but as you can see in this article, you have heard the name HTML a lot, and you have noticed that JavaScript is based on HTML elements, so it seems that for a better understanding of this article, you should also be given a brief explanation about it so that you can master in this field.
What is HTML?
It stands for Hyper Text Markup Language, which is a language that is often used in the design of web pages. In fact, in this language, all the code is converted to HTML and displayed by the browser. The version used these days is HTML5, so we will give you a brief description of it below.
What is HTML5?
HTML5 is the latest version of HTML that can provide many capabilities, including the ability to run images, audio, and video files which can be effective in attracting different users to the site; this version can create very high graphics for websites, the advantage of this version compared to HTML4 is that by using it, you can ensure that the content that you intend to provide is presented correctly on different devices, and also with the help of this version, another possibility is provided that without the need for additional plugins, you can provide videos and other features to the customer and reach your main goal as a web owner, which causes gaining more customers because your website will be introduced to users' friends so that you can achieve success with the help of HTML5 as soon as possible.
Last word:
In general, as you can see, the JavaScript commands may be in different places, which we have mentioned in this article, and to make you more aware of it as well as HTML in general, we have explained each of them in detail, we hope you find the content and its examples useful.
Click to analyze your wesbite SEO