Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Rivas-Jorge authored Feb 5, 2023
1 parent ec69373 commit 5031ed8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///text to search code
///text to search
function search() {
let textToSearch = document.getElementById("text-to-search").value;
let paragraph = document.getElementById("paragraph");
Expand All @@ -10,7 +10,7 @@ function search() {
paragraph.innerHTML = paragraph.textContent.replace(pattern, match => `<mark>${match}</mark>`)
}

///sticky header code
///sticky header

window.onscroll = function () {myFunction()};

Expand All @@ -25,3 +25,14 @@ function myFunction() {
}
}


//search book function in main page

function searchBook() {
var bookName = document.getElementById("text-to-search").value.toLowerCase();
if (bookName === "the alchemist") {
window.location.href = "alchemist.html";
} else if (bookName === "life of pi") {
window.location.href = "lifeofpi.html";
}
}

0 comments on commit 5031ed8

Please sign in to comment.