Assignment in programming is when you take a value and you store it in a property (e.g. document.body.style.color, someimg.src, or window.location) or a variable. When you change something this is almost always done with assignment, if only indirectly (such as with a function call). This is done with the '=' operator. Variable also touches on the differences between assignment and mathematical equals. What is important to note is that when the assignment operator = is processed, then whatever value is on the right will be stored in the place on the left. The directionality is important: "x=2;" is fine but "2=x" will cause an error because there is no location labelled by '2' that can store the value of x. Also, note than in
Examples:
Changing Properties (someObject.style.CSSPropertyName and someImage.src)
The Code
<button onclick="document.body.style.backgroundColor='green';">Background Color to green</button>
<input type="button" onclick="document.body.style.backgroundColor='gray';" value="Background Color to gray" />
<br /><br />