Forums

ForumsProgramming Forum

Website links

Posted Sep 18, '11 at 5:40pm

ExplosionsHurt

ExplosionsHurt

247 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

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

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

function gotoGamesPage()
{
window.location = "http://www.explosionshurt.webs.com/games"
}

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

jayjay9

jayjay9

459 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

Darkroot

Darkroot

2,549 posts

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

Games

 
Reply to Website links

You must be logged in to post a reply!