-
JavaScript Introduction to Browser Events
Events are considered occurrences or actions, happening in the system you are developing that the latter informs you about so that you can respond to them. In brief, it is a signal that something has happened in your system. All of the DOM nodes generate signals like that ( of course, they are not limited…
-
JavaScript Coordinates
For moving elements around, it is necessary to learn about coordinates. The majority of JavaScript methods operate with one of the following two coordinate systems: Relative to the window and relative to the document. The first system is like position:fixed and is calculated from the window top/left edge. Its coordinates will be denoted as clientX/clientY. The second one…
-
JavaScript Window Sizes and Scrolling
For finding the width and height of the browser window, for scrolling the page using JavaScript, and more actions, the root document element document.documentElement is used. It corresponds to the <html> tag. But, there are other essential methods and peculiarities we are going to cover in this chapter. Width/height of the Window For getting the window height and width,…
-
Styles and Classes
In this chapter, we are going to show you how to alter the DOM by modifying styles and classes. But, before getting into the JavaScript ways of modifying styles and classes let’s check out an important rule. In general, there exist two ways of styling an element: As it was mentioned above, JavaScript is also capable of modifying both…
-
JavaScript Modifying the document
The key to creating so-called “live” pages is DOM modification. In this chapter, we are going to show you how to create new elements on the fly, as well as modify the existing page content. When writing apps or web pages, the first thing you will want to do is manipulating the document structure. Normally,…
-
Attributes and Properties
In HTML, you can write, declare elements, and pass values in attributes. In JavaScript, particularly in DOM, there are properties available while querying HTML elements via the DOM. In this chapter, the attributes, and properties of JavaScript are covered. DOM Properties JavaScript DOM objects have properties. They are like instance variables for the particular element.…
-
Node Properties:Type, Tag and Contents
In this chapter, we are going to take an in-depth look at the DOM nodes in JavaScript. Let’s explore what they are and learn their most common properties. DOM Node Classes Different DOM nodes obtain various properties. For example, an element node that corresponds to tag <a> has link-related properties. The one that corresponds to <input> has input-related properties. Text nodes and…
-
JavaScript Searching:getElement*, querySelector*
As you already know, JavaScript DOM is a tree-like structure, made of all the elements existing in your HTML document. What is essential is that the HTML elements are floating around in a way that you want to access and read data from or change it. There exist many ways of finding those elements. In this chapter, you will find out…
-
JavaScript Browser Environment, Specs
Initially, JavaScript was created for web browsers. But, since then, it has expanded and become a language with different platforms and uses. A platform can be a browser, a web-server, or another host. Each of them includes a platform-specific functionality. For JavaScript specification, it is a host environment. A host environment has its own objects and functions…
-
JavaScript File and FileReader
Let’s explore File and FileReader in JavaScript. As a rule, a file object inherits from the Blob. It can be extended to filesystem-related facilities. You can obtain it in two ways: The file objects have the same properties as Blob. But, they also have some additional properties such as the name (the file name) and the lastModified(last modification timestamp). Let’s see how the File object…
