Commit d0ba28e3 authored by David Garner's avatar David Garner
Browse files

Added Readme and Fixed Table headers

parent 0c365bfa
# Lab6
Matthew Burket and David Garner
\ No newline at end of file
Matthew Burket and David Garner
In our booksLibrary.js file the class Library, Shelf, and Book are created.
The library.js file instinates a library object and adds shelves and books to the library. Then uses JQuery to populate an HTMl table.
The 'Checkout' button is used to checkout a book once it has been clicked. The books will not be visuall removed from the page, the user is able to see how many copies are left. If the user tries to checkout a book that has 0 copies left, The book will be said to be unavalible.
**Our desigin is inspired by the http://www.openbsd.org/ project
\ No newline at end of file
......@@ -3,7 +3,7 @@
*/
jQuery(function() {
var i, j, lib, table, currentShelf, currentBook, cell, bookTitleStr, topRow;
var i, j, lib, table, currentShelf, currentBook, cell, bookTitleStr, topRow, headerRow, header;
lib = new Library("Iowa State Library");
i = 0;
while (i < 3) {
......@@ -47,14 +47,12 @@ jQuery(function() {
topRow = table.insertRow(-1);
for (i = 0; i < lib.shelves.length; i++) {
currentShelf = lib.shelves[i];
topRow.insertCell(-1).innerHTML = currentShelf.name;
for (j = 1; j < currentShelf.books.length; j++) {
if(i == 0){
table.insertRow(-1);
}
bookTitle = currentShelf.books[j].name;
table.rows[j].insertCell(-1).innerHTML = bookTitle;
cell = table.rows[j].cells[i];
cell.className = "styleClass";
......@@ -67,4 +65,17 @@ jQuery(function() {
)
}
}
});
\ No newline at end of file
header = table.createTHead();
headerRow = header.insertRow(0)
for (i = 0; i < lib.shelves.length; i++) {
headerRow.insertCell(-1).innerHTML = lib.shelves[i].name
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment