ch04
142
Chapter ZIPs/JavaScript/ch04/carla/carla.css
Executable file
@@ -0,0 +1,142 @@
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
background-image: url(background.gif);
|
||||
color: #0000FF;
|
||||
font-family: Geneva, Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
#container { margin-left: auto;
|
||||
margin-right: auto;
|
||||
width:85%;
|
||||
min-width:700px;
|
||||
}
|
||||
|
||||
|
||||
#logo {
|
||||
text-align:center;
|
||||
margin: 0;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
padding-top: 30px;
|
||||
padding-bottom: 20px;
|
||||
|
||||
}
|
||||
#nav {
|
||||
float: left;
|
||||
width: 200px;
|
||||
padding-top: 10px;
|
||||
text-align:left;
|
||||
color: #FF0000;
|
||||
font-size: 14px;
|
||||
}
|
||||
#nav a {
|
||||
text-decoration:none;
|
||||
margin: 15px;
|
||||
display: block;
|
||||
color: #FF0000;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#content {
|
||||
margin-left: 150px;
|
||||
padding: 30px;
|
||||
overflow:auto;
|
||||
border: medium groove #0000FF;
|
||||
line-height: 135%;
|
||||
|
||||
}
|
||||
|
||||
.floatright {padding-left:20px;
|
||||
float:right;
|
||||
}
|
||||
.floatleft {
|
||||
float:left;
|
||||
padding: 2px 30px 20px;
|
||||
}
|
||||
#footer {
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
text-align: justify;
|
||||
border-top: thin none;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
color: #FF0000;
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2 { text-transform: uppercase;
|
||||
color: #0000FF;
|
||||
font-size: 36px;
|
||||
border-bottom: 1px none;
|
||||
margin-right: 20px;
|
||||
}
|
||||
h3 {
|
||||
color: #0000FF;
|
||||
border-bottom: thin none;
|
||||
margin-right: auto;
|
||||
text-align: left;
|
||||
padding-top: 20px;
|
||||
padding-right: 100px;
|
||||
padding-bottom: 20px;
|
||||
padding-left: 100px;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-left-style: none;
|
||||
}
|
||||
.details { padding-left:20%;
|
||||
padding-right:20%;
|
||||
}
|
||||
|
||||
|
||||
img {border:0 none; }
|
||||
|
||||
|
||||
.content {
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
a {
|
||||
color: #FF0000;
|
||||
text-decoration: none;
|
||||
margin: 15px;
|
||||
color: #FF0000;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
a:hover {
|
||||
color: #FFFF00;
|
||||
background-color: #0000FF;
|
||||
}
|
||||
h4 {
|
||||
line-height: 150%;
|
||||
margin-right: 20%;
|
||||
margin-left: 15%;
|
||||
text-align: center;
|
||||
}
|
||||
h1 {
|
||||
font-family: Geneva, Arial, Helvetica, sans-serif;
|
||||
font-size: 36pt;
|
||||
text-align: center;
|
||||
margin-right: 15%;
|
||||
margin-left: 20%;
|
||||
}
|
||||
p {
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
font-size: 14px;
|
||||
line-height: 120%;
|
||||
font-weight: bold;
|
||||
color: #0000FF;
|
||||
}
|
||||
.flt_img {
|
||||
float: none;
|
||||
padding-top: 3px;
|
||||
padding-right: 20px;
|
||||
padding-bottom: 3px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
specialh4 {
|
||||
line-height: 150%;
|
||||
margin-right: 20%;
|
||||
margin-left: 15%;
|
||||
text-align: center;
|
||||
}
|
136
Chapter ZIPs/JavaScript/ch04/carla/carla_math_whiz.html
Executable file
@@ -0,0 +1,136 @@
|
||||
<!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" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Carla's Classroom | Become a Math Whiz!</title>
|
||||
<link href="carla.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
|
||||
function addIt()
|
||||
{
|
||||
levelOne();
|
||||
function levelOne()
|
||||
{
|
||||
var count1 = 1;
|
||||
var choice = "y";
|
||||
var num = 0;
|
||||
var countX = 1;
|
||||
//Prompt for default or enter number of problems for this level
|
||||
var choice = prompt("Do you want to continue only until you get 5 correct? Type 'y' for yes or 'n' for no:", " ");
|
||||
if ((choice == "y") || (choice == "Y")) //if student chooses default
|
||||
{
|
||||
num = count1;
|
||||
choice = "y";
|
||||
}
|
||||
else
|
||||
if ((choice != "y")||(choice !="Y")) //if student chooses to enter a number
|
||||
{
|
||||
num = parseInt(prompt("How many problems in total do you want to try?", " "));
|
||||
choice = "n";
|
||||
}
|
||||
//loop to continue generating addition problems
|
||||
while (((choice == "y") && (count1 < 6)) || ((choice == "n") && (countX <= num)))
|
||||
{
|
||||
var num1a = (Math.floor(Math.random() * 10)) + 1;
|
||||
var num1b = (Math.floor(Math.random() * 10)) + 1;
|
||||
var sum1 = num1a + num1b;
|
||||
var response = parseInt(prompt("What is the sum of " + num1a + " and " + num1b + " ?"));
|
||||
if (response == sum1)
|
||||
{
|
||||
count1 = count1 + 1;
|
||||
var result = "correct!";
|
||||
alert(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "incorrect";
|
||||
alert(result);
|
||||
}
|
||||
countX = countX + 1
|
||||
}
|
||||
alert("You completed " + (countX - 1) + " problems and got " + (count1 - 1) + " correct.");
|
||||
//Level One problems are done, call Level Two
|
||||
var move = prompt("Do you want to move to Level Two? Type 'y' for yes or 'n' to end this session", " ");
|
||||
if ((move == "y") || (move == "Y"))
|
||||
{
|
||||
levelTwo();
|
||||
}
|
||||
else
|
||||
alert("This session is ended.");
|
||||
}
|
||||
function levelTwo()
|
||||
{
|
||||
var count2 = 1;
|
||||
alert("you're at level 2");
|
||||
while (count2 < 6)
|
||||
{
|
||||
var num2a = (Math.floor(Math.random() * 100)) + 1;
|
||||
var num2b = (Math.floor(Math.random() * 100)) + 1;
|
||||
var sum2 = num2a + num2b;
|
||||
var response = parseInt(prompt("What is the sum of " + num2a + " and " + num2b + " ?"));
|
||||
if (response == sum2)
|
||||
{
|
||||
count2 = count2 + 1;
|
||||
var result = "correct!";
|
||||
alert(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "incorrect";
|
||||
alert(result);
|
||||
}
|
||||
}
|
||||
levelThree();
|
||||
}
|
||||
function levelThree()
|
||||
{
|
||||
var count3 = 1;
|
||||
alert("you're at level 3");
|
||||
while (count3 < 6)
|
||||
{
|
||||
var num3a = (Math.floor(Math.random() * 100)) + 1;
|
||||
var num3b = (Math.floor(Math.random() * 100)) + 1;
|
||||
var num3c = (Math.floor(Math.random() * 100)) + 1;
|
||||
var sum3 = num3a + num3b + num3c;
|
||||
var response = parseInt(prompt("What is the sum of " + num3a + ", " + num3b + ", and " + num3c + " ?"));
|
||||
if (response == sum3)
|
||||
{
|
||||
count3 = count3 + 1;
|
||||
var result = "correct!";
|
||||
alert(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "incorrect";
|
||||
alert(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<img src="images/arith_big.jpg" class="floatleft" />
|
||||
<h1 id="logo">Become a Math Whiz!</h1>
|
||||
|
||||
<div align="left">
|
||||
<blockquote>
|
||||
<a href="index.html"><img src="images/owl_button.jpg" />Home</a>
|
||||
<a href="carla.html"><img src="images/carla_button.jpg" />Meet Carla </a>
|
||||
<a href="reading.html"><img src="images/read_button.jpg" />Reading</a>
|
||||
<a href="writing.html"><img src="images/write_button.jpg" width="50" height="50" />Writing</a>
|
||||
<a href="math.html"><img src="images/arith_button.jpg" />Arithmetic</a>
|
||||
<br /></blockquote> </div>
|
||||
<div id="content">
|
||||
<p>There are two parts to this arithmetic test: addition and subtraction. Each part will increase in difficulty
|
||||
as you prove you are ready for harder problems. You may choose whether you want to move to another
|
||||
level after getting 5 questions correct or you may choose how many problems you want to
|
||||
attempt at any level.</p>
|
||||
<p><input type="button" onclick="addIt()" value="begin the addition test" /> </p>
|
||||
<p><input type="button" onclick="subIt()" value="begin the subtraction test" /> </p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer"> <h3>*Carla's Motto: Never miss a chance to teach -- and to learn!</h3>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/arith_big.jpg
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/arith_button.jpg
Executable file
After Width: | Height: | Size: 1.0 KiB |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/carla_button.jpg
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/carla_pic.jpg
Executable file
After Width: | Height: | Size: 6.6 KiB |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/owl_button.jpg
Executable file
After Width: | Height: | Size: 527 B |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/owl_logo.jpg
Executable file
After Width: | Height: | Size: 7.6 KiB |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/read_button.jpg
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/write_button.jpg
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
Chapter ZIPs/JavaScript/ch04/carla/images/writing_big.jpg
Executable file
After Width: | Height: | Size: 8.0 KiB |
47
Chapter ZIPs/JavaScript/ch04/carla/math.html
Executable file
@@ -0,0 +1,47 @@
|
||||
<!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" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Carla's Classroom | Math Lessons</title>
|
||||
<link href="carla.css" rel="stylesheet" type="text/css" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
<!--
|
||||
.style1 {font-size: 24px}
|
||||
.style2 {font-size: 18px}
|
||||
.style3 {
|
||||
color: #0000FF;
|
||||
font-size: 18px;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
|
||||
<img src="images/owl_logo.JPG" class="floatleft" />
|
||||
<h1 id="logo"><em>Carla's Classroom</em></h1>
|
||||
<p> </p>
|
||||
<div style="clear:both;"></div>
|
||||
<div align="left">
|
||||
<blockquote>
|
||||
<a href="index.html"><img src="images/owl_button.jpg" />Home</a>
|
||||
<a href="carla.html"><img src="images/carla_button.jpg" width="50" height="65" />Meet Carla </a>
|
||||
<a href="reading.html"><img src="images/read_button.jpg" width="50" height="50" />Reading</a>
|
||||
<a href="writing.html"><img src="images/write_button.jpg" width="50" height="50" />Writing</a>
|
||||
<a href="math.html"><img src="images/arith_button.jpg" width="50" height="50" />Arithmetic</a>
|
||||
<br />
|
||||
</blockquote>
|
||||
</div>
|
||||
<div id="content">
|
||||
<p><img src="images/carla_pic.jpg" width="83" height="108" class="floatleft" /> Arithmetic Lessons: </p>
|
||||
<p><a href="carla_adding.html">Addition Exercise</a>
|
||||
<p><a href="carla_math_whiz.html">Advanced Addition and Subtraction Exercises</a>
|
||||
|
||||
</div>
|
||||
<div id="footer"> <h3><span class="style1">*</span><span class="style3">Carla's Motto: </span><span class="style2">Never miss a chance to
|
||||
teach -- and to learn!</span></h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|