Skip to content

Instantly share code, notes, and snippets.

@kf4x
Created April 27, 2012 23:51
Show Gist options
  • Save kf4x/2514376 to your computer and use it in GitHub Desktop.
Save kf4x/2514376 to your computer and use it in GitHub Desktop.
JavaScript Exam 3 working with arrays. -HTML-
<!--
name: Javier Chavez
email: jchavez589@cnm.edu
-->
<!DOCTYPE html>
<html>
<head>
<title>Javier Chavez - P6</title>
<link rel="stylesheet" type="text/css" href="main.css">
<script type="text/javascript" src="ChavezLT3.js"></script>
</head>
<body>
<div id="content">
<div class="hero-unit">
<h1 id="array_statistics_program">Fruit Stand Market Place</h1>
<h2>Written By Javier Chavez</h2>
</div>
<form class="well">
<label for="entered">Enter the fruit you want to buy below (please enter 0 or more)</label>
apples <input name="apples" id="apples" value="6"><br>
oranges <input name="oranges" id="oranges" value="4"><br>
bananas <input name="bananas" id="bananas" value="5"><br>
peaches <input name="peaches" id="peaches" value="2"><br>
<span class="help-inline"></span><br>
<button class="btn" type="button" onclick="
var fruits = new Array();
fruits[0] = document.getElementById('apples').value;
fruits[1] = document.getElementById('oranges').value;
fruits[2] = document.getElementById('bananas').value;
fruits[3] = document.getElementById('peaches').value;
document.getElementById('stats').innerHTML = CalculatePrices(fruits); ">Tell me the stats!</button>
<!-- send user input to enteredNumbers then call parseArrary with arg -->
<button class="btn" id="clear" type="button" onclick="
document.getElementById('apples').value = '6';
document.getElementById('oranges').value = '4';
document.getElementById('peaches').value = '5';
document.getElementById('bananas').value = '2';
document.getElementById('stats').innerHTML = ''">Reset</button>
<!-- reset to original numbers and erase the stats -->
</form>
<div class="row" id="stats"> <!-- stats -->
</div>
</div><!-- #content -->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment