Skip to main content
gregh50245282
Participant
March 10, 2021
Question

help with if else statement

  • March 10, 2021
  • 1 reply
  • 264 views

I am trying to get this to work but im having problems, can anyone help me please, I have it writing the answer to mychoice, but i cant get it to go to a url if the answer is "english13i34gb128gbblack" , this is what I have on the frame action at the end of the timeline:

 

var _this = this;

_this.stop();

mychoice = language + size + cpu + ram + ssd + colour


document.write("Your choices are: " + mychoice);


if(mychoice = "english13i34gb128gbblack") {
window.open('https://www.success.com/', '_blank');
} else {
window.open('http://nomatches.com/', '_blank');
}

 

This topic has been closed for replies.

1 reply

gregh50245282
Participant
March 10, 2021

thanks, that is correct, i just figured it out before you posted, for anyone looking at this, here is my corrected code:

 

var _this = this;

_this.stop();

mychoice = language + size + cpu + ram + ssd + colour


document.write("Your choices are: " + mychoice);


if(mychoice == "english13i34gb128gbblack") {
window.open('https://success.com', '_blank');
} else {
_this.stop();
}

 

if(mychoice == "french15i732gb2tsandstone") {
window.open('https://www.french.com/', '_blank');
} else {
_this.stop();
}