ForumsProgramming Forum

Website links

Posted Sep 18, '11 at 5:40pm



262 posts

I've been working on a webpage and I've being trying to get a button to link to another website.

Eventually, I solved it by giving the button an id ("yellowButton") and referring to it in Javascript:

var button = document.getElementById("yellowButton");

yellowButton.addEventListener('click', gotoGamesPage, false);

function gotoGamesPage()
window.location = ""

Doing it this way seems a bit primitive, because I'll have to do the above thing for every single button in the website. Is there any other, easier way to link a button to a different page?


Posted Sep 29, '11 at 11:20am



500 posts

I think people, don't reply on this topic, cuz they don't understand what u mean. BTW, I don't understand it?


Posted Sep 29, '11 at 1:25pm



2,880 posts

Felt primitive since you could do the same thing with a little html code?

<a href="" class="yellowButton">Games</a>

Reply to Website links

You must be logged in to post a reply!