Library System in JavaScript with Source Code

Library System in JavaScript with Source Code

The Library System in JavaScript is a system project created using HTML, CSS, and JavaScript. JavaScript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else, can update and change both HTML and CSS.

This simple mini project for Library System in JavaScript is complete and totally error free and  also includes a downloadable Source Code for free, just find the downloadable source code below and click to start downloading. Before you start to click the download now first you must click the Run Quick Scan for secure Download. 

Taking about the highlights of this Library System framework, the client can make the rundown of books with their writers and keep them as records. You simply need to type the book data in the text fields and click the add button to include the data to the record.

Anyway if you want level up your knowledge in programming especially C/C++ Programming Language, try this new article I’ve made for you Best C Projects with Source Code for Beginners Free Download 2020.

I have here a suggested list of Best JavaScript Projects with Source Code Free to download and I’m sure this can help you to improve your skills in JavaScript programming and web development as a whole.

To start creating a Library System in JavaScript, make sure that you have any platform in creating a JavaScriptbootstrap, and HTML installed in your computer, in my case I will use Sublime Text.

Steps on how to create a Library System in JavaScript with Source Code

Library System in JavaScript with Source Code

  • Step 1: Open Sublime Text.

    First after installing sublime text IDE, click “open” to start.Open Sublime for Library System using JavaScript with Source Code

  • Step 2: Create a HTML file.

    Second click “file” and select “save as” and named it “index.htmlwrite index html for Library System using JavaScript with Source Code

  • Step 3: Create a JavaScript file.

    Third click “file” and select “save as” and named it “libraryscript.jswrite libraryscript js for Library System using JavaScript with Source Code

  • Step 4: The actual code.

    You are free to copy the code given below and paste to your different file created.

This code is for the index.html

In the code given below, which is the code contains the interface of the application. This code will show the form that will be use in html.(Library System in JavaScript with Source Code)

Library System


<div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav mr-auto"> <li class="nav-item active"> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li> </ul> <form class="form-inline my-2 my-lg-0"> <input class="form-control mr-sm-2" id="searchTxt" type="search" placeholder="Search" aria-label="Search"> <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> </form> </div> </nav> <div id="message"></div> <div class="container my-3"> <h1>Library System</h1> <hr> <form id="libraryForm"> <div class="form-group row"> <label for="bookName" class="col-sm-2 col-form-label">Name</label> <div class="col-sm-10"> <input type="text" class="form-control" id="bookName" placeholder="Book Name"> </div> </div> <div class="form-group row"> <label for="Author" class="col-sm-2 col-form-label">Author</label> <div class="col-sm-10"> <input type="text" class="form-control" id="author" placeholder="Author"> </div> </div> <fieldset class="form-group"> <div class="row"> <legend class="col-form-label col-sm-2 pt-0">Type</legend> <div class="col-sm-10"> <div class="form-check"> <input class="form-check-input" type="radio" name="type" id="philippine" value="philippine" checked> <label class="form-check-label" for="philippine"> Philippines History </label> </div> <div class="form-check"> <inpu> </label> </div> <div class="form-check disabled"> <input class="form-check-input" type="radio" name="type" id="science" value="science"> <label class="form-check-label" for="science"> Science </label> </div> </div> </div> </fieldset>

This code is for the CSS

In the code given below, which is for the code for creating a link in CSS for library system.

href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"

This code is for the libraryscript.js

In the code given below, which is for the code for creating a script for library system.

console.log('This is ITSOURCECODE Project');
class Library {
constructor(name, author, type) {
this.name = name;
this.author = author;
this.type = type;
}
}
class Display {
add(bookoflibrary) {
console.log("Adding to UI");
let tableBody = document.getElementById('tableBody');
let uiString = <tr> <td>${bookoflibrary.name}</td> <td>${bookoflibrary.author}</td> <td>${bookoflibrary.type}</td> </tr>;
tableBody.innerHTML += uiString;
}
clear() { let libraryForm = document.getElementById('libraryForm'); libraryForm.reset(); } validate(bookoflibrary) { if (bookoflibrary.name.length < 2 || bookoflibrary.author.length < 2) { return false } else { return true; } } show(type, displayMessage) { let message = document.getElementById('message'); let boldText; if(type==='success'){ boldText = 'Success'; } else{ boldText = 'Error!'; } message.innerHTML = `<div class="alert alert-${type} alert-dismissible fade show" role="alert"> <strong>${boldText}:</strong> ${displayMessage} <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div>`; setTimeout(function () { message.innerHTML = '' }, 5000); }
}
// Add submit event listener to libraryForm
let libraryForm = document.getElementById('libraryForm');
libraryForm.addEventListener('submit', libraryFormSubmit);
function libraryFormSubmit(e) {
console.log('YOu have submitted library form');
let name = document.getElementById('bookName').value;
let author = document.getElementById('author').value;
let type;
let philippine = document.getElementById('philippine');
let programming = document.getElementById('programming');
let science = document.getElementById('science');
if (philippine.checked) { type = philippine.value; } else if (programming.checked) { type = programming.value; } else if (science.checked) { type = science.value; } let bookoflibrary = new Library(name, author, type); console.log(bookoflibrary); let display = new Display(); if (display.validate(bookoflibrary)) { display.add(bookoflibrary); display.clear(); display.show('success', 'Your book has been successfully added') } else { // Show error to the user display.show('danger', 'Sorry you cannot add this book'); } e.preventDefault();
}
ABOUT PROJECTPROJECT DETAILS
Project Name :Library System in JavaScript
Project Platform :JavaScript
Programming Language Used:php,javascript,html,css
Developer Name :itsourcecode.com
IDE Tool (Recommended):Sublime
Project Type :Web Application
Database:None
Upload Date:October 19, 2020

Downloadable Source Code

Summary

In summary, this 2022 Library System in JavaScript with Source Code can be useful to students or professional who wants to learn web development using technologies like HTML, CSS and JavaScript. This project can also be modified to fit your personal requirements. Hope this project will help you to improve your skills. Happy coding!

That’s how you create Library System using JavaScript with Source Code in your projects. You can always expand and try different ways in implementing the Library System in JavaScript in your JavaScript projects. In this Mini Project for Library System in JavaScript with Source Code is free to download and It is easy to understand and manipulate this project and use for education purpose only.

Inquiries

If you have any questions or suggestions about Library System in JavaScript with Source Code, please feel free to leave a comment below.

1 thought on “Library System in JavaScript with Source Code”

Leave a Comment