-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
57 lines (48 loc) · 1.39 KB
/
index.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<title>Nacho's Books - Homepage</title>
</head>
<body>
<h1>Homepage</h1>
<script src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script src="getBooks.js"></script>
<!-- This doesn't seem to work, linking getBooks.js. Maybe once I am finished with the file I can copy it here. -->
<p>Search for a book below!!</p>
<input id='search'></input>
<button class='button' id='submit' onclick='getBooks()'>Submit</button>
<script>
function displayText(text) {
$("body").append("<p>" + text + "</p>")
}
function displayHeader(header, text) {
$("body").append("<" + header + ">" + text + "</" + header + ">")
}
function getBooks() {
alert("Finding books...")
var search = document.getElementById("search")
alert("We are checking for book matches!!")
var books = [
"Python-printing text":"This book teaches how to print text in Python, and other useful resources that can be used to print text.",
"Book 2":"This is book number 2"
]'
displayHeader("h2", "Results:")
if (search in books) {
alert("Almost done...")
displayText(books[search])
}
}
</script>
<style>
h1 {
color: gold;
}
body {
background-color: blue;
}
p {
color: white;
}
</style>
</body>
</html>