<INPUT TYPE="button" VALUE="Click for Good Grade"
ONCLICK="alert('So far so good!');">
<INPUT TYPE="button" VALUE="Click for Good Grade"
ONCLICK="document.TestForm2.Grade.value='A';">
<INPUT TYPE="button" VALUE="Click for More Points"
ONCLICK="document.TestForm3.Score.value =
parseFloat(document.TestForm3.Score.value) + 10;">
<INPUT TYPE="button" VALUE="Show Heads"
ONCLICK="document.images.coin.src =
'http://www.dickinson.edu/~cs131/heads.gif';">
<TABLE> <TR> <TD> Mike </TD> <TD> Red </TD> <TD> Dogs </TD> </TR> <TR> <TD> Kate </TD> <TD> Blue </TD> <TD> Cats </TD> </TR> </TABLE>
function test1(x) {
var r;
r = 0;
if (x < 5) {
r = 1;
}
if (x > 20) {
r = 2;
}
if (x <= 10) {
r = 3;
}
return r;
}
function test2(x, y) {
var r;
r = 0;
if (x > 10) {
if (y <= 5) {
r = 1;
}
else {
r = 2;
}
}
else {
r = 3;
}
return r;
}
var count;
count = 2;
while (count <= 6) {
document.write(count + "<BR>");
count = count + Math.floor(count / 2);
}
document.write(count);
function canIBePresident(age, country) {
if (age >= 35 && country == "USA") {
alert("Yes, you can be president!");
}
else {
alert("No, you can not be president!");
}
}
function flipTillHeads() {
var coin1, coin2;
coin1 = "tails";
coin2 = "tails";
while (coin1 == "tails" || coin2 == "tails") {
coin1 = randomOneOf(["heads","tails"]);
coin2 = randomOneOf(["heads","tails"]);
document.FlipForm.count.value =
parseFloat(document.FlipForm.count.value) + 1;
}
}