What are JavaScripts? Basic Functions of JavaScript

Table of contents:

What are JavaScripts? Basic Functions of JavaScript
What are JavaScripts? Basic Functions of JavaScript
Anonim

Web scripts are programs that are written directly in html code or simply in files, whichever is preferable. These programs are written in JavaScript. Thus, speaking of what Javascripts is, we can say that it is a programming language that is interpretive.

what is javascript
what is javascript

JavaScript is read by the browser, and then the written expressions are executed and the manipulations that are set on the page are performed. JavaScript is similar in syntax to programming languages such as Java, C++, and C. JavaScript owes its existence to the development of companies such as Sun Microsystems (Oracle) and Netscape (Mozilla). The original name of the language was LiveScript. However, due to the then very popular Java language from Sun Microsystems, Netscape's marketing department decided to change the name of the language to JavaScript. At the same time, there was a calculation that this step would add popularity to the language. Also, speaking about what Javascripts are, it should be noted that Java and JavaScript are two different languages.

ECMA-262 is the official standard for this language. The name of this JavaScript language is ECMAScript.

functionsjavascript
functionsjavascript

To learn this language, previous knowledge of CSS and Html will come in handy. If until now you did not know about CSS and Html, then you should immediately read it.

Limitations and features of JavaScript

The following features appear when using [removed] scripts on web pages:

  • Adding various animation effects that can't be done with Html and CSS.
  • Ability to change the content of Html elements and add new tags without reloading the page.
  • Responding to events (responding to user actions) - processing keystrokes on the keyboard and moving the mouse cursor.
  • Perform validation of the data that has been entered into the form fields before being sent to the server. This reduces the load on the server and speeds up the site.
  • Detecting the browser version and loading the required page depending on it.

This is not a complete list of scripting features that have been written in this language, JavaScript functions have a much broader meaning.

javascript objects
javascript objects

In addition to the above features, there are limitations to using scripts:

  • No access to files hosted on the user's computer. In general, there is no access outside of the web page itself. The only exceptions are cookies, which can be read and written using JavaScript. Objects of this type are usually only needed to make the page load faster.
  • Nothe ability to perform cross-domain requests, that is, accessing web pages that are on a different domain, even if they are open in adjacent tabs.
  • It is not possible to close tabs and windows that were opened with it.
  • It is not possible to protect the original text on the page and prohibit copying images or text from the page. However, it remains possible to add some restrictions, which JavaScript functions allow.

Restrictions like this, in a way, make it harder for malicious code to execute.

javascript strings
javascript strings

What is Javascripts?

As noted above, JavaScript is a language that makes web pages interactive. With the help of this language, those applications are created that are included in the Html code. For example, forms or registration forms filled out by the user. JavaScript is often confused with Java, but the two languages have little in common.

Some even compare JavaScript to other languages Ruby, Self, Python. But it is a separate language.

Using JavaScript

Using JavaScript, you can make changes to the page, change the styles of elements, add or remove tags. It is also possible to learn about the user's actions on the page (reducing or increasing the working area of the screen, clicking with the mouse, pressing any keys, scrolling the page). It is possible to access any element of the Html code and manipulate this element. Thus, the answer to the question "What are JavaScripts?" will bebeing able to load data without reloading the page, typing messages, setting or reading cookies, and more.

javascript elements
javascript elements

Basic of JavaScript uniqueness

The main uniqueness of this language is that it has support for almost all browsers and has full integration with them. All actions with JavaScript are very simple. There is no other technology that can accommodate all of these benefits. For example, there are not cross-browsers, they are not supported by all browsers (these are XUL, ActiveX, VBScript). There are also those that are not fully integrated with the browser. These are Silverlight, Flash, Java. At the moment, there is a lot of development of such technology and elements of JavaScript 2 are under development.

Alternative programming languages

Sometimes JavaScript is limited. In this case, the following programming languages will help.

Java

The most used language is Java. Using this language, complex algorithms are described, but this is not always required on a regular site. For this reason, java-applets take a long time to load and are large.

Flash

From the beginning, Flash was designed to be cross-browser and for creating multimedia objects. For example, to create interactive areas on the site, games, banners, audio and video players. Among other things, using Flash, sockets (network connections) are created, you can work with multimedia, store objects that do not need to be sentserver requests. There are convenient graphical development tools for Flash.

If we compare the disadvantages of Flash and JavaScript, whose objects are very different, then the main disadvantage of Flash is its poor indexing by search engines. This is because search engines follow Html links. There is also no option to highlight text in a Flash container.

Silverlight, Vbscript, JavaFX, XUL

Silverlight, Vbscript, JavaFX, XUL technologies are used to complement the capabilities of JavaScript when building interfaces and communications. They are still used more rarely than Flash and JavaScript. To highlight the features of each of them, you can say the following:

- XUL - used to describe desktop applications and interfaces. But it is possible only if the program is created under Mozilla.

- JavaFX - works on a computer only with Java, as it is an addition to this language.

- Vbscript was developed by Microsoft Corporation. The basis was Visual Basic. This language does not develop in any way, nowadays it is almost not used, it is inferior to JavaScript in terms of capabilities.

Silverlight was developed by Microsoft as a competitor for Flash. He also does not have much popularity, tk. JavaScript strings can provide many more page scripts.

javascript vk
javascript vk

How to enable JavaScript and what is JavaScript error

Now it's worth discussing the everyday problems of users on the network. Today it happens more and morethat the user after visiting his page in the social. network sees in the upper window an error message "JavaScript is not enabled", "For the site to work properly, please enable JavaScript", "JavaScript error". How to fix this is a serious question, because. at the same time, there are difficulties with uploading videos and photos for the user.

How JavaScript is enabled in Mozilla Firefox

If the user works in Mozilla, you need to go to "Tools", then to "Settings". Then, on the "Content" tab, you need to check the box next to "Use JavaScript".

javascript error how to fix
javascript error how to fix

How JavaScript is enabled in Google Chrom

To enable or disable JavaScript in this browser, the following sequence of actions is required: "Configure and manage Google Chrom", "Options", "Advanced", "Personal data (content settings)", "JavaScript". Allow all sites to use JavaScript (recommended).

How JavaScript is enabled in Opera

To enable or disable JavaScript in this browser, do the following:

- Press F12.- Select "Enable JavaScript".

How JavaScript is enabled in IE ("Internet Explorer")

To enable or disable JavaScript in the "Internet Explorer", you need to do the following: "Tools", "Internet Options", the "Security" tab, "Select the Internet zone", the "Other" button, the "Scripts" item, "Allow scripts".

JavaScript on VK

Extremely popular in the CISThe social network VKontakte often brings unpleasant surprises. Increasingly, VKontakte users complain about the inability to listen to audio or the inability to view video. To solve this problem, a JavaScript error fix on the VKontakte network is required.

What is a VK JavaScript error?

User visited his page on the social network and tried to play a video or audio file, but after that he found the inscription "JavaScript error: initAddMedia is not defined" in the upper left corner. This message appears when an error occurs"[removed] initAddMedia".

Methods for solving the problem with an error in the social network "VKontakte":

- First you need to go to "Start", "My Computer" and the Windows folder. Then go to the system32 section and the driver folder. Then to the folder etc.

- Among a small number of files in this folder, you need to select the hosts file. Then this file is opened using Notepad. It looks like this: you need to right-click on the hosts file and select "Open with". Next, you can select "WordPad Text Editor".

After opening this file, you need to look at the file with the entry 127.0.0.1 localhost. Any other entries are superfluous and only hinder and block the stable operation of audio and video files. It is necessary to remove completely all information from the file and copy only this inscription 127.0.0.1 localhost. Next, you need to click "Save" and restart your computer. The next time you visit the page "VKontakte" everything will work fine.

Popular topic

Editor's choice

  • How to block a person in "Contact"? Protect your page from ill-wishers
    How to block a person in "Contact"? Protect your page from ill-wishers

    The popularity of social networks is increasing every day. This is due to the fact that such an instrument of mass communication has entered everyday life and firmly established itself in it, as one of the most convenient ways of communication. Almost every advanced person has his own page on the social network, where he posts his photos, posts posts and, most importantly, communicates with friends and makes new acquaintances

  • Why doesn't "VK" work? The VKontakte website is not working: what to do?
    Why doesn't "VK" work? The VKontakte website is not working: what to do?

    Social media addiction is considered one of the most serious cyber diseases. Every day, tens of millions of users around the globe visit their personal accounts, chatting with friends, discussing the latest events in the world. Social networks have become such a dense part of our lives that it seems unusual to spend a day without looking at them even for a second

  • What is button accordion? Learn slang online
    What is button accordion? Learn slang online

    The Internet is a territory with its own rules, language, style of communication, and, more recently, laws. It so happened that many new users may be left at a loss after communicating with hardened Internet - "hacks". We are talking, first of all, about the use of slang by the latter in their language, which is far from accessible to everyone who opened the page of any forum for the first time

  • Hashtag - what is it? How to use hashtags
    Hashtag - what is it? How to use hashtags

    The Internet is constantly progressing, and every day new features appear in it that make working on it more convenient. They are associated, as a rule, with the optimization and structuring of information, since there is such a large amount of it on the World Wide Web that it is sometimes difficult to find the necessary material. For example, in the recent past, so-called hashtags appeared

  • Why is the internet slow? The most important reasons
    Why is the internet slow? The most important reasons

    In the last couple of years, the Internet has become an important part of the life of almost every person. Using the World Wide Web, we can find out the weather, the latest world news, download the necessary programs, play online games, etc. When the Internet is working well, doing the above things is very nice, but what if all of a sudden web pages start to load for a very long time, and online games slow down?