-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
43 lines (34 loc) · 1.48 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import Book from './modules/books.js';
import handleTime from './modules/dateTime.js';
window.addEventListener('load', () => {
handleTime();
});
const Bookstore = new Book();
window.onload = () => { Bookstore.addBookToList(); };
document.querySelector('#book-form').addEventListener('submit', (e) => {
e.preventDefault();
const title = document.querySelector('#title');
const author = document.querySelector('#tuthor');
Bookstore.addBook(title.value, author.value);
title.value = '';
author.value = '';
});
const list = document.querySelector('#n1');
const addBook = document.querySelector('#n2');
const contactUs = document.querySelector('#n3');
list.addEventListener('click', () => {
document.getElementById('show-book').style.cssText = 'display: flex;';
document.getElementById('book-form').style.cssText = 'display: none;';
document.getElementById('show-contact').style.cssText = 'display: none;';
});
addBook.addEventListener('click', () => {
document.getElementById('show-book').style.cssText = 'display: none;';
document.getElementById('book-form').style.cssText = 'display: flex;';
document.getElementById('show-contact').style.cssText = 'display: none;';
});
contactUs.addEventListener('click', () => {
document.getElementById('show-book').style.cssText = 'display: none;';
document.getElementById('book-form').style.cssText = 'display: none;';
document.getElementById('show-contact').style.cssText = 'display: flex;';
});
export default { list, addBook, contactUs };