jeudi 26 mars 2015

Javascript result to open a new page in same window


I'm using the code for this roulette on codepen for a personal project: http://ift.tt/1D0SFGF. It's all working fine but I'm trying to have the result of the roulette open a specific page in the same window. I'm not sure to target the result of the roulette. My approach was to set values to each variables and create a function:



function openDestinationResult() {
var $100 = "index.html";
var $200 = "content.html";
...
if ($100 === "$100")
{
document.location.replace("result1.html");
}
else if ($200 === "$200")
{
document.location.replace("result2.html");
}


but this obviously doesn't work. I'm new at using javascript so bear with me!


Thanks for any tips/solutions.


cheers





Aucun commentaire:

Enregistrer un commentaire