0

I'm trying to create a website with a Home Page UI from which loads of different files (pages) could be navigated to. I've set up the Home page (index.html with its css, jQuery & JS loading correctly). But I can't seem to get a grasp on how to integrate my vision of buttons on a home page which will redirect user to other HTML pages with corresponding links to CSS, JS & jQuery. But my question is more specific:

How do you render HTML files in express with a function in a js file? in directory:

C:\CodingProjects\Principles\ public\javascripts\home.js

(Principles being the project folder)

I've namely set up a function which executes when I click a button, like so:

<button onclick="BoostOddsRedirect()">Boost your odds of success through de-centralized principle-guided decision-making.</button>

& JS ofc:

const BoostOddsRedirect = () => {
//Here I want the functionality of rendering another HTML file, namely BoostOdds.html, with the directory: C:\CodingProjects\Principles\public\markups\IntPrinHTML\BoostOdds.html
};

Which I've tested to be correctly linked in HTML file in which button with onclick attribute is created.

It'd be great if solution can be reproduced for other buttons and other files effieciently.

What I've done is just intuitive start of a functionality which I do not know how to complete, so if you have a better idea, I'd love to here it. Please let me know if you need more info, thanks.

David Rönnlid
  • 91
  • 1
  • 11
  • 1
    Possible duplicate of [How to create an HTML button that acts like a link?](https://stackoverflow.com/questions/2906582/how-to-create-an-html-button-that-acts-like-a-link) – Twisty Dec 02 '18 at 18:44
  • I'll check it out, thanks – David Rönnlid Dec 02 '18 at 18:46
  • Found a solution: `` Where href="/" is the local directory of file on computer (/relative to current directory in app) you want to load on click. – David Rönnlid Dec 02 '18 at 19:08
  • Your problem description sounds like all you need is a plain and simple hyperlink. So why not simply `Title`? If you want it to look like a button, [check this out](http://www.hyperlinkcode.com/button-links.php). – Andreas Vogl Dec 02 '18 at 20:53
  • Possible duplicate of [How do I redirect to another webpage?](https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage) – Smollet777 Dec 03 '18 at 07:28
  • @AndreasVogl Perfect! This was exactly what I was looking for. – David Rönnlid Dec 03 '18 at 07:36

0 Answers0