javascript - How to automatially go to the otherpage after clearing some fields? -
i making scratchcard game , need know how check if cleared go next page. show u part of code have
i got 9 of these scratch pads , want go other page when cleared nine:
var images = [], index = 0; images[0] = "images/slide1.jpg"; images[1] = "images/slide2.jpg"; images[2] = "images/slide3.jpg"; images[3] = "images/logo.jpg"; images[4] = "images/winner.png"; images[5] = "images/scratch-to-win.png"; index = math.floor(math.random() * images.length); $('#nummer9').wscratchpad({ scratchmove: function (e, percent) { console.log(percent); if (percent > 70) { this.clear(); } } }); $("#nummer9").wscratchpad('bg', images[index]); $("#nummer9").wscratchpad('fg', 'images/overlay.png'); $("#nummer9").wscratchpad('size', '15'); $("#nummer9").wscratchpad('cursor', 'url("./images/coin.png") 5 5, default');
and need know have put inside if statement.
if () { window.alert('alle vakjes zijn open gekrast'); window.location.href="geenprijs.php"; }
var images = [], var cleared = 0; index = 0; images[0] = "images/slide1.jpg"; images[1] = "images/slide2.jpg"; images[2] = "images/slide3.jpg"; images[3] = "images/logo.jpg"; images[4] = "images/winner.png"; images[5] = "images/scratch-to-win.png"; index = math.floor(math.random() * images.length); $('#nummer9').wscratchpad({ scratchmove: function (e, percent) { console.log(percent); if (percent > 70) { this.clear(); cleared++; } } }); $("#nummer9").wscratchpad('bg', images[index]); $("#nummer9").wscratchpad('fg', 'images/overlay.png'); $("#nummer9").wscratchpad('size', '15'); $("#nummer9").wscratchpad('cursor', 'url("./images/coin.png") 5 5, default');
then
if (cleared === 9) { window.alert('alle vakjes zijn open gekrast'); window.location.href="geenprijs.php"; }
Comments
Post a Comment