Home > Article > Web Front-end > How to implement random naming of an array
var random = parseInt(Math.random()*arr.length); for(var i = 0; i < lis.length; i++) { lis[i].className = ""; } lis[random].className = "style";
*(Find the object, multiple lis, traverse it, clear everyone, the number of i in lis[i] is assigned randomly)
About exclusivity, remove the empty space in the front and assign the value in the back , the attributes must be exactly the same, otherwise it will be useless! ! !
Exclusive
1The first layer is used to control all input objects
2Click one of the inputs to trigger an event
3Kill everyone for ""
4Resurrect myself this.""
Assume that all selections are true, and the top one is true;
input[i]The selections after traversal are One false, all of them are false, there is no
in the aboveThe above is the detailed content of How to implement random naming of an array. For more information, please follow other related articles on the PHP Chinese website!