Сообщения

Сообщения за декабрь, 2019

JavaScript Common Mistakes

JavaScript programs may generate unexpected results if a programmer accidentally uses an assignment operator ( = ), instead of a comparison operator ( == ) in an if statement. <p id="demo"></p> <script> var x = 0; document.getElementById("demo").innerHTML = Boolean(x == 8); </script> This  if  statement returns  false  (as expected) because x is not equal to 8:

JavaScript Random

Math.random() Math.random()  returns a random number between 0 (inclusive),  and 1 (exclusive): <h2>JavaScript Math.random()</h2> <p>Math.random выбирает любое рандомное число между 0 и 1:</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = Math.random(); </script> JavaScript Math.random() Math.random выбирает любое рандомное число между 0 и 1:

JavaScript Math Object

The JavaScript Math object allows you to perform mathematical tasks on numbers. <h2>JavaScript Math.PI</h2> <p>Посмотрим, как будет выглядеть число Пи:</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = Math.PI; </script> JavaScript Math.PI Посмотрим, как будет выглядеть число Пи:

JavaScript Statements

Example: <h2>JavaScript Statements</h2> <p>A <b>JavaScript program</b> is a list of <b>statements</b> to be executed by a computer.</p> <p id="demo"></p> <script> var x, y, z;  // Statement 1 x = 4;    // Statement 2 y = 7;    // Statement 3 z = x + y;  // Statement 4 document.getElementById("demo").innerHTML = "The value of z is " + z + "."; JavaScript Statements A JavaScript program is a list of statements to be executed by a computer. </script>

JavaScript Arithmetic

JavaScript Arithmetic Operators Arithmetic operators perform arithmetic on numbers (literals or variables). <p>A typical arithmetic operation takes two numbers and produces a new number.</p> <p id="demo"></p> <script> var x = 10 + 35; document.getElementById("demo").innerHTML = x; </script> Operator Description + Addition - Subtraction * Multiplication ** Exponentiation ( ES2016 ) / Division % Modulus (Remainder) ++ Increment -- Decrement A typical arithmetic operation takes two numbers and produces a new number.

CSS Tables

CSS  Tables The look of an HTML table can be greatly improved with CSS: <style> #customers {   font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;   border-collapse: collapse;   width: 100%; } #customers td, #customers th {   border: 1px solid #ddd;   padding: 8px; } #customers tr:nth-child(even){background-color: #f2f2f2;} #customers tr:hover {background-color: #ddd;} #customers th {   padding-top: 12px;   padding-bottom: 12px;   text-align: left;   background-color: #4CAF50;   color: white; } </style> </head> <body> <table id="customers">   <tr>     <th>Имя</th>     <th>Фамилия</th>     <th>Номер телефона</th>   </tr>   <tr>     <td>Петя</td>     <td>Гришечкин</td>     <td>22211873</td>   </tr>   <tr>     <td>Аня</td>     <td&g

CCS Position

The  position  property specifies the type of positioning method used for an element (static, relative, fixed, absolute or sticky). position: static; <style> div.static {   position: static;   border: 3px solid #73AD21; } </style> position: static; Теперь этот текст расположен так, как я это выбрала:

CSS Links

Links can be styled with any CSS property (e.g.  color ,  font-family ,  background , etc.). <style> a {   color: hotpink; } https://www.w3schools.com/css/css_link.asp </style> Оно в примере уже сработвло как ссылка