Some Examples of if statements: 1) Based on the if statement in chooseAURL, but uses OR (i.e. ||) to set odds: var n = randInt(1,3); var theSite = ""; if (n == 1 || n == 2) { theSite = "common.html"; } else if (n == 3) { theSite = "rarer.html"; } return theSite; /* if n is 1 or 2, returns common.html, which means common.html has a 2/3 chance of being returned, but there is only a 1/3 chance that rarer.html will be returned */ 2) One choice: if true, do this (if not true, it won't do anything) if (countvar > 100) { document.write("Too Many"); } /* if the variable countvar is greater than 100, write "Too Many" on the page */ 3) Multiple choices along with ELSE IF. Also uses 2 conditions: if this AND this are both true... if (thisminute >= 0 && thisminute <10) { document.bgColor = "black"; } else if (thisminute >= 10 && thisminute <20) { document.bgColor = "silver"; } else if (thisminute >= 20 && thisminute <30) { document.bgColor = "white"; } else if (thisminute >= 30 && thisminute <40) { document.bgColor = "yellow"; } else if (thisminute >= 40 && thisminute <50) { document.bgColor = "green"; } else if (thisminute >= 50 && thisminute <60) { document.bgColor = "blue"; } /* This originally was in an old script that would change the page background colour based on what minute (in the hour) it was. Hence the importance of ranges of numbers within 0 to 59. */ 4) Multiple choices with an ELSE line. Also uses 2 different variables and 3 conditions: if this AND this AND this are true... if (today == 1 && hour>= 13 && hour< 18) { return "inthisclass.html"; } else if (today == 4 && hour>= 8 && hour< 12) { return "inthatclass.html"; } else { return "whoknows.html"; } /* This originally was from a script that would help indicate what class a person was attending. The today variable holds the day of the week, and the hour variable holds the hour of the day. */ /* the else line at the end will execute if no other line executes */ 5) Multiple choices with ELSE IF and ELSE. if (s == "") { alert("You just hit OK, but didn't type a number."); } else if (s == null) { alert("You just hit Cancel, but didn't type a number."); } else if (isNaN(parseInt(s))) { alert("You entered " + s + ", but " + s + " is not a number."); } else { alert("You entered " + s + ". Thank you."); } /* the else line at the end will execute if no other line executes */ 6) One possibility, using OR (||). IF this OR this is true, do something... if (name == "Justina" || name == "Jessica") { alert("Yes!"); } /* if neither is true, it will do nothing */