Home > Net >  How to make a subpage with HTML/JS?
How to make a subpage with HTML/JS?

Time:09-05

So I am making a website that will take info from one and transfer it to a subpage on the click of a button. How can I make it so the user will go to a subpage when they click a button?

CodePudding user response:

Create button with an EventListener onclick function that will change the source or link to the subpage link

CodePudding user response:

You may have asked about redirecting like here, but 'subpage' may've been referring to a page inside the folder of the current one.

<!-- presuming the current page is http://example.com/page/ -->
<button onclick="location.href='http://example.com/page/sub.html'"></button>

would become shortly

<button onclick="location.href='sub.html'"></button>

This involves the use of location.href.

  • Related