diff --git a/case1/mpl_links_txt.html b/case1/mpl_links.html
similarity index 97%
rename from case1/mpl_links_txt.html
rename to case1/mpl_links.html
index 956d056..f25aa84 100644
--- a/case1/mpl_links_txt.html
+++ b/case1/mpl_links.html
@@ -7,8 +7,8 @@
Case Problem 1
Monroe Public Library Government Links
- Author:
- Date:
+ Author: Steven Thompson & Dylan Brune
+ Date: April 10, 2019
Filename: mpl_links.html
-->
@@ -17,6 +17,7 @@
+
diff --git a/case1/mpl_links.js b/case1/mpl_links.js
new file mode 100644
index 0000000..d620240
--- /dev/null
+++ b/case1/mpl_links.js
@@ -0,0 +1,24 @@
+"use strict";
+
+/*
+ New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
+ Tutorial 13
+ Case Problem 1
+
+ Author: Steven Thompson & Dylan Brune
+ Date: April 10, 2019
+
+ Filename: mpl_links.js
+
+*/
+
+
+window.addEventListener("load", function() {
+ var allSelect = document.querySelectorAll("form#govLinks select");
+
+ for (var i = 0; i < allSelect.length; i++) {
+ allSelect[i].onchange = function(e) {
+ location.href = e.target.value;
+ }
+ }
+});
diff --git a/case1/mpl_links_txt.js b/case1/mpl_links_txt.js
deleted file mode 100644
index fe21beb..0000000
--- a/case1/mpl_links_txt.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-
-/*
- New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
- Tutorial 13
- Case Problem 1
-
- Author:
- Date:
-
- Filename: mpl_links.js
-
-*/
-
-
diff --git a/case2/dl_expense_txt.html b/case2/dl_expense.html
similarity index 91%
rename from case2/dl_expense_txt.html
rename to case2/dl_expense.html
index 48fadef..d1e83fe 100644
--- a/case2/dl_expense_txt.html
+++ b/case2/dl_expense.html
@@ -7,8 +7,8 @@
Case Problem 2
Travel Expense Report
- Author:
- Date:
+ Author: Steven Thompson & Dylan Brune
+ Date: April 10, 2019
Filename: dl_expense.html
-->
@@ -17,6 +17,7 @@
+
@@ -70,20 +71,20 @@ Expense Report
First Name* |
M.I. |
Account* |
- |
+ |
|
|
|
Department* |
- |
+ |
| Social Security Number* |
- |
+ |
Project* |
- |
+ |
diff --git a/case2/dl_expense.js b/case2/dl_expense.js
new file mode 100644
index 0000000..0d34c51
--- /dev/null
+++ b/case2/dl_expense.js
@@ -0,0 +1,95 @@
+"use strict";
+
+/*
+ New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
+ Tutorial 13
+ Case Problem 2
+
+ Author: Steven Thompson & Dylan Brune
+ Date: April 10, 2019
+
+ Filename: dl_expense.js
+
+ Function List
+ =============
+
+ validateSummary()
+ Validates the data entry in the summary field.
+
+ calcClass(sumClass)
+ Sums up all of the data values for elements of the sumClass class.
+
+ calcExp()
+ Calculates the travel expenses from all categories and dates.
+
+ formatNumber(val, decimals)
+ Formats the value, "val" to the number of decimals indicated
+ by "decimals", adding thousands separators.
+
+ formatUSCurrency(val)
+ Formats the value, "val", as U.S. currency.
+
+*/
+
+window.addEventListener("load", function() {
+ var changingCells = document.querySelectorAll("table#travelExp input.sum");
+
+ for (var i = 0; i < changingCells.length; i++) {
+ changingCells[i].onchange = calcExp;
+ }
+
+ document.getElementById("submitButton").onclick = function() {
+ validateSummary();
+ };
+});
+
+function validateSummary() {
+ var summary = document.getElementById("summary");
+ if (summary.validity.valueMissing) {
+ summary.setCustomValidity("You must include a summary of the trip in your report.");
+ } else {
+ summary.setCustomValidity("");
+ }
+}
+
+function calcClass(sumClass) {
+ var sumFields = document.getElementsByClassName(sumClass);
+ var sumTotal = 0;
+
+ for (var i=0; i < sumFields.length; i++) {
+ var itemValue = parseFloat(sumFields[i].value);
+ if (!isNaN(itemValue)) {
+ sumTotal += itemValue;
+ }
+ }
+ return sumTotal;
+}
+
+
+function calcExp() {
+
+ var expTable = document.querySelectorAll("table#travelExp tbody tr");
+
+ for (var i = 0; i < expTable.length; i++) {
+ document.getElementById("subtotal"+i).value = formatNumber(calcClass("date"+i), 2);
+ }
+
+ document.getElementById("transTotal").value = formatNumber(calcClass("trans"), 2);
+ document.getElementById("lodgeTotal").value = formatNumber(calcClass("lodge"), 2);
+ document.getElementById("mealTotal").value = formatNumber(calcClass("meal"), 2);
+ document.getElementById("otherTotal").value = formatNumber(calcClass("other"), 2);
+ document.getElementById("expTotal").value = formatUSCurrency(calcClass("sum"));
+}
+
+
+
+
+
+function formatNumber(val, decimals) {
+ return val.toLocaleString(undefined, {minimumFractionDigits: decimals,
+ maximumFractionDigits: decimals});
+}
+
+function formatUSCurrency(val) {
+ return val.toLocaleString('en-US', {style: "currency", currency: "USD"} );
+}
diff --git a/case2/dl_expense_txt.js b/case2/dl_expense_txt.js
index bc32b41..e6498a9 100644
--- a/case2/dl_expense_txt.js
+++ b/case2/dl_expense_txt.js
@@ -5,8 +5,8 @@
Tutorial 13
Case Problem 2
- Author:
- Date:
+ Author: Steven Thompson & Dylan Brune
+ Date: April 10, 2019
Filename: dl_expenses.js
@@ -35,9 +35,6 @@
-
-
-
function formatNumber(val, decimals) {
return val.toLocaleString(undefined, {minimumFractionDigits: decimals,
maximumFractionDigits: decimals});
@@ -45,4 +42,4 @@ function formatNumber(val, decimals) {
function formatUSCurrency(val) {
return val.toLocaleString('en-US', {style: "currency", currency: "USD"} );
-}
\ No newline at end of file
+}
diff --git a/case3/mas_reg2_txt.html b/case3/mas_reg2.html
similarity index 94%
rename from case3/mas_reg2_txt.html
rename to case3/mas_reg2.html
index 63ca91a..606dfc4 100644
--- a/case3/mas_reg2_txt.html
+++ b/case3/mas_reg2.html
@@ -7,9 +7,9 @@
Case Problem 3
Media Arts Society Registration Form #2
- Author:
- Date:
-
+ Author: Steven Thompson & Dylan Brune
+ Date: April 10 2019
+
Filename: mas_reg2.html
-->
@@ -19,7 +19,8 @@
MAS Registration Payment Form
->
+
+
@@ -139,4 +140,4 @@ MAS22 Payment Form
-