Javascript article,Where are JavaScript web programming language commands located?
نوشته شده توسط : dotnek

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 in order to achieve their desired goals, there are several commands in this language that need to be placed in the right place in order 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 , in order 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 actually 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 are going to mention in the following.

1. Between the <head> ... </head> tag

2. Between the <body> ... </body> tag

3. In the external file with an extension ".js"

- Between the <head> ... </head> and <body> ... </body> tags:

Consider the following example, which is another example of it.

<html>
<head>
<title> JavaScipt Example </title>
<Script type = "text / javascript">
// function to add two numbers
Function sum (a, b) {
Return (a + b);
}
</script>
</head>

<body>
<Script type = "text / javascript">
// function to subtract two numbers
Function sub (a, b) {
Return (a-b);
}
</script>
<p> Here, we are printing sum & sum ... </p>
<P id = "result1"> </p>
<P id = "result2"> </p>

<Script type = "text / javascript">
// calling functions & printing the values
Document.getElementById ("result1"). InnerHTML = "sum =" + sum (10,20);
Document.getElementById ("result2"). InnerHTML = "sub =" + sub (10,20);
</script>
</body>
</html>

- 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. 

 

Read more on:https://www.dotnek.com/Blog/Web/where-are-javascript-web-programming-language

link:https://dotnek.mystrikingly.com/

Related link:programovanie hier





:: برچسب‌ها: dotnek , seo , site ,
:: بازدید از این مطلب : 51
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0
تاریخ انتشار : دو شنبه 18 مرداد 1400 | نظرات ()
مطالب مرتبط با این پست
لیست
می توانید دیدگاه خود را بنویسید


نام
آدرس ایمیل
وب سایت/بلاگ
:) :( ;) :D
;)) :X :? :P
:* =(( :O };-
:B /:) =DD :S
-) :-(( :-| :-))
نظر خصوصی

 کد را وارد نمایید:

آپلود عکس دلخواه: