|
Build a Library Management System Using html, css, and JavaScript (Source Code) By Faraz
|
səhifə | 4/6 | tarix | 22.03.2024 | ölçüsü | 293,01 Kb. | | #168954 |
| Build a Library Management System Using HTML
Sl No. |
Date of issue |
Reader |
Book Name |
Genre |
|
src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"
>
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
crossorigin="anonymous"
>
Copy
Read Also Create a Responsive Hotel Landing Page to Boost Bookings | HTML, CSS, JavaScript
Step 2 (CSS Code):
No custom CSS thanks to Bootstrap!
/*
No custom CSS thanks to Bootstrap!
https://getbootstrap.com/
*/
Copy
Step 3 (JavaScript Code):
Finally, we need to create a function in JavaScript. Here's an explanation of the code's functionality:
1. Function inputs(userName, bookName, type): This function defines a constructor for creating objects representing book inputs. It takes three parameters: userName (user's name), bookName (name of the book), and type (type of the book).
2. Class Display: This class contains methods to manage the display of book information and interact with the user interface.
constructor(): The class constructor, which is empty in this case.
add(arrayInputs): This method takes an array of book input objects as a parameter. It generates HTML rows for each input and appends them to a table in the UI.
clear(): This method clears the input fields in the form.
validate(inputs): This method validates whether the input fields are filled correctly (user name and book name are not empty).
alertuser(type, sub, massage): This method adds an alert message to the UI with a specified type (success, danger), subject, and message. The alert is automatically removed after 4 seconds.
checkIssue(listArray, o1): This method checks whether a book is already issued by searching the listArray of book inputs. If the book is issued, it returns 0; otherwise, it returns 1.
Dostları ilə paylaş: |
|
|