+ 1
How can I create a interactive page
I want to make a page with buttons that can take you to a new page
8 Antworten
+ 3
Make a button with onclick function
<button onclick="showAboutPage()">About Page</button>
JAVASCRIPT:
// first grab the two divs (about and home)
let home = document.querySelector("#home")
let about = document.querySelector("#about")
functionshowAboutPage() {
home.style.display = "none"
about.style.display = "block"
// Making about div visible and home div invisible through javascript.r
}
similarly create a showHomePage function and do the opposite in it.
+ 4
You can create an <a> </a> tag
You give an attribute inside <a href="./about.html">ABOUT PAGE</a>
This is a link, when someone clicks on it he would be taken to the about page, of course you can customise the styles of <a> tag so that it can look like a button.
Some examples of styles:
a {
text-decoration: none;
padding:20px;
color:white;
background-color: #242424;
border-radius: 20px;
}
This wouldn't work on sololearn though, cuz you can't make multiple html files linked to each other here, so you gotta make some sections inside only one file, and give each section an id or class, make a button, which when clicked toggles the display property of sections.
+ 4
Kintu Michael Evans bruh? How much more would i explain, search on youtube "DOM Manipulation" and see the courses from Traversy Media and The Net Ninja.
+ 3
Kintu Michael Evans your code has <a href = "#"> which means its gonna take you nowhere.
+ 2
Thanks
+ 1
Ok can you format my code
+ 1
Ok now what can I do to improve it
+ 1
Explain more