JSFiddle - React, Tailwind, and code Playground
by mori57
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Week 8 - Javascript</title>
<link href="master.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
</head>
<body>
<h1>Week 8 - Javascript</h1>
<br>
<fieldset>
<h2>Problem #1</h2>
<p>Enter the three numbers, then the average will be calculated.</p>
<script type="text/javascript">
function test1() {
var kounter = 1;
var number = 0;
var total = 0;
var average = 0;
while (kounter <= 3)
{
number = prompt("Enter number " + kounter + " please" , 0);
total = total + parseFloat(number);
kounter = kounter + 1;
}
document.getElementById('output1').value = "Sum of the numbers is " + total + "\nAll done!";
}
</script>
<input type="button" value="Test" onclick="test1();" >
<br>
<textarea id="output1" rows="2" cols="50" disabled></textarea>
</fieldset>
<br>
<br>
<fieldset>
<h2>Problem #2</h2>
<p>Enter the name of the item, then the purchasing price and store price to see profit.</p>
<script type="text/javascript">
function test2() {
var item = "item";
var cost = 0;
var price = 0;
var profit = 0;
item = prompt("Enter the name of the item please." , "item");
cost = prompt("Enter the initial cost (in $) please." , 0);
price = prompt("Enter your sell price (in $) please." , 0);
profit = price - cost;
document.getElementById('output2').value = "Profit for " + item + " is $" + profit + "!";
}
</script>
<input type="button" value="Test" onclick="test2();" >
<br>
<textarea id="output2" rows="1" cols="50" disabled></textarea>
</fieldset>
<br>
<br>
<fieldset>
<h2>Problem #3</h2>
<p>Enter the name of the item, then the purchasing price and store price to see profit.</p>
<script type="text/javascript">
function test3() {
var kounter = 1;
var grade = 0;
var total = 0;
var average = 0;
while (kounter <= 3)
{
grade = prompt("Enter grade " + kounter + " please" , 0);
total = total + parseFloat(grade);
kounter = kounter + 1;
}
average =...
CSS
body
{
background-image: url('http://cisweb.bristolcc.edu/~jcharron17/master.png');
background-position: top left;
background-repeat: repeat;
background-attachment: fixed;
color: #F16F01;
}
fieldset
{
background-color: #F16F01;
color: black;
border: solid 8px #F16F01;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
width: 50%;
}
h1
{
text-align: center;
font-family: "Myriad Pro", "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
}
h2
{
color: black;
font-family: "Myriad Pro", "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
}