Csspartb
Csspartb
1.0 Rational :
The library Management system helps to manage tasks by adding and removing
Books. It uses web technologies Html, Javascript making it easy understand and
A greate way to learn about library Management system .
Here are step-by-step algorithm for the simple library management system you’ve
created:
Step 1:Start.
Step 2:Display HTML page with a form to enter book details and a list to show added
books.
Step 3:User enters book details.
• Book title
• Authot
Step 4:User clicks “Add Book” button.
• Run the addBook() function.
Step 5:Check if both inputs are filled:
• If yes, proceed to add the book
• If no, do nothing.
Step 6:Create a new list item with the book’s title and author, plus a “Remove” Button.
Step 7:Add the list item to the “Library Inventory” list.
Step 8:Clear the input fields so the user can add another book.
Step 9: Save the book list in localStorage:
• Convert the list of books to a string using innerHTML.
• Use localStorage.setItem(‘books’, bookList) to save the list in localStorage.
Step 10: Load the saved books from localStorage when the page reloads:
• Use localStorage.getItem(‘books’) to retrieve the saved list.
• If books exist, display them in the “Library Inventory” list.
Step 11: User can click the “Remove” button to delete a book from the list.
Step 12: After removing a book, save the updated list to localStorage again.
Step 13: Prevent page reload when the button is clicked by returning false.
Step 14: Repeat for adding more books.
Step 15: End
CODE:
<!DOCTYPE html>
<html lang=”en”>
<head>
<title>Simple Library Management</title>
</head>
<body>
<form id=”book-form”>
<table border=”” align=”center”>
<tr>
<td colspan=”2” align=”center”>
<h2>
Library Management System
</h2>
</td>
</tr>
<tr>
<td colspan=”2” align=”center”>
<h2>Add a New Book</h2>
</td>
</tr>
<tr>
<td colspan=”2” align=”center”>
<input type=”text” id=”title” placeholder=”Book Title” />
<br>
<input type=”text” id=”author” placeholder=”Author” />
<br>
<button type=”submit” onclick=”return addBook()”>Add Book</button>
</td>
</tr>
<tr>
<td colspan=”2” align=”center”>
<h2>Library Inventory</h2>
</td>
</tr>
<tr>
<td>
<ul id=”book-list”></ul>
</td>
</tr>
</table>
</form>
<script>
Window.onload = function() {
loadBooks();
};
Function addBook() {
Var title = document.getElementById(‘title’).value;
Var author = document.getElementById(‘author’).value;
If (title && author)
{
Function loadBooks() {
Var savedBooks = localStorage.getItem(‘books’);
If (savedBooks) {
Document.getElementById(‘book-list’).innerHTML = savedBooks;
}
}
</script>
</body>
</html>
Output:
8.0 Skill Developed:
a. Problem-Solving Skills.
b. Communication Skill.
c. Time Management
9.0 .Reference:-
10. Applications:
11. Conclusion:
In this project, the simple library management system allows users to add and remove books
dynamically. Users can input a book's title and author, and upon clicking "Add Book," the
book is added to a list. The system ensures both fields are filled before adding a book. Each
book entry includes a "Remove" button for deleting the book from the list. once the page is
reloaded the previously entered books and author displays. JavaScript handles the input,
validation, and dynamic list updates with reloading the page. It's an easy way to manage as
small book collection interactively.