Class One Code Examples

Get the dice images as an archive.

Example 1:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example 1</title>
<style>
  #example1 { color:#0099CC; }
</style>
</head>
<body>
<div id="example1">
<input type="button" onclick="document.getElementById('example1').style.fontSize='32px';" value="*1*" />
HI THERE
</div>
</body>
</html>

Example 2:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example 2</title>
<style> #example1 { color:#0099CC; } </style>
<script language="javascript" type="text/javascript">
function resizeText(multiplier) {
if (document.body.style.fontSize == "") {
document.body.style.fontSize = "1.0em"; }
document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";
}
function resetText() {
document.body.style.fontSize = "1.0em";
document.getElementById('example1').style.fontSize='12px';
}
</script>
</head>
<body>
<h2>Page Header</h2>
<div id="example1">
<input type="button" onclick="resizeText(2.0)" value="*2*" />
<input type="button" onclick="resetText()" value="*3*" />
HI THERE
</div>
</body>
</html>

Example 3:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Example 3</title>
</head>
<body>
<img id="die" src="1.jpg">
<input type="button" onclick="document.getElementById('die').src=Math.floor(1+Math.random()*6) + '.jpg';" value="ROLL" />
</body>
</html>

Example 4:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Example 4</title>
</head>
<body>
<img id="die" src="1.jpg" onmouseover="document.getElementById('die').src=Math.floor(1+Math.random()*6) + '.jpg';">
<p id="roll_value"> </p>
</body>
</html>

Example 5:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Example 5</title>
<script>
var theRoll = 1;
</script>
</head>

<body>
<img id="die" src="1.jpg" onmouseover="theRoll=Math.floor(1+Math.random()*6);document.getElementById('die').src=theRoll + '.jpg';document.getElementById('roll_value').innerHTML='The roll value is: ' + theRoll">
<p style="font-size=24px" id="roll_value"></p>
</body>
</html>