Home  >  Article  >  Web Front-end  >  How to implement random naming of an array

How to implement random naming of an array

一个新手
一个新手Original
2017-09-23 09:52:482074browse

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 above

The 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn