if...else statements
EasyProgramming.net tutorial on conditions - the if...else statement
by akmiecik
HTML
The color is <span class="color">___</span>
<br /><br />
JavaScript
var color = 'blue';
var output = Document.getElementsByClassName('color');
if(color == 'red'){
output.innerText = "red!";
output.style.color = 'red';
} else if(color == 'blue'){
output.innerText = "blue!";
output.style.color = 'blue';
} else if(color == 'green'){
output.innerText = "green!";
output.style.color = 'green';
} else {
output.innerText = "something else";
output.style.color = 'purple';
}