This article mainly introduces the special effects of the javascript lantern draw, which has some reference value. if you are interested, you can refer to the examples in this article to explain the special effects of the javascript lantern draw, which is especially suitable for lottery activities, the content is as follows:
Lottery gamesScript window. onload = init; var setting = {count: 0, total: 24, delay: 20, picIndex: [0, 1, 2, 4, 7, 6, 5, 3]} function init () {document. getElementById ("drawBtn "). onclick = function () {setting. count = 0; setting. delay = 20; this. disable = true; // disable the button var drawBtn = this; // Obtain the p var allDivs = document for all images. getElementsByClassName ("pic"); // Obtain a random integer that represents the winning position, 3*8 + (0-7) setting. total + = Math. floor (Math. random () * allDivs. length); // Set the timer to change the color of each p border in sequence. setTimeout (function show () {// reset the color of the last border for (var I = 0; isetting. total) {alert ("You have won, haha"); drawBtn. disable = false; return;} setTimeout (show, setting. delay) ;}, setting. delay) ;}} script
1
2
3
4
5
6
7
8
The above is the detailed content of this article, hoping to help you learn.