HTML and CSS Reference
In-Depth Information
Event Handler
Occurs When
onstorage
The contents of a storage object change
onsubmit
A Web form is submitted
onunload
The browser navigates away from the page and unloads it
Operators
Description
Assignment
Operators used to assign values to variables
=
Assigns the value of the variable on the right to the variable on the
left (
x = y
)
+=
Adds the two variables and assigns the result to the variable on the
left (
x += y
is
equivalent to
x = x + y
)
-=
Subtracts the variable on the right from the variable on the left
and assigns the result to the variable on the left (
x- = y
is equiva-
lent to
x = x - y
)
*=
Multiplies the two variables together and assigns the result to the
variable on the left
(
x *= y
is equivalent to
x = x * y
)
/=
Divides the variable on the left by the variable on the right and
assigns the result to the variable on the left (
x /= y
is equivalent to
x = x / y
)
&=
Combines two expressions into a single expression (
x &= y
is equiva-
lent to
x = x & y
)
%=
Divides the variable on the left by the variable on the right and
assigns the remainder to the variable on the left (
x %= y
is equivalent
to
x = x % y
)
Arithmetic
Operators used for arithmetic functions
+
Adds two variables together (
x + y
)
-
Subtracts the variable on the right from the variable on the left (
x - y
)
*
Multiplies two variables together (
x * y
)
/
Divides the variable the left by the variable on the right (
x / y
)
%
Calculates the remainder after dividing the variable on the left by the
variable on the right (
x % y
)
++
Increases the value of a variable by 1 (
x ++
is equivalent to
x = x + 1
)
&
Combines two expressions (
x & y
) Decreases the value of variable
by 1 (
x --
is equivalent to
x = x - 1
)
-
Changes the sign of a variable (-
x
)
Comparison
Operators used for comparing expressions
==
Returns true when the two expressions are equal (
x == y
)
!=
Returns true when the two expressions are not equal (
x != y
)
!==
Returns true when the values of the two expressions are equal
(
x !== y
)
>
Returns true when the expression on the left is greater than the
expression on the right (
x > y
)
<
Returns true when the expression on the left is less than the expres-
sion on the right (
x < y
)