Este es en realidad un ejercicio para los números aleatorios JS. Primero escriba los nombres de todos en una matriz por adelantado, y luego deje que los valores en la matriz se muestren rápidamente en el área. Cuando presione parar, el desplazamiento se detendrá para lograr un efecto aleatorio.
<! DocType html> <html> <fead> <meta charset = "utf-8"/> <title> nombre aleatorio escrito por js-qiongtai blog </title> <script type = "text/javaScript"> var isrun = true; var a = ["zhang san", "li si", "Wang wu", "," vAR ARATIR]; Action (str) {var s = document.getElementById ("bt"). valor; if (s == "inicio") {isRun = true; run (); document.getElementById ("bt"). valor = "end";} else {isRun = false; document.getElementById ("bt"). value = "inicio";}} run () Math.floor (math.random () * a.length+ 1) -1; document.getElementById ("show"). Innerhtml = a [i]; if (isrun == false) {var b = true; for (var j en a2) {if (a2 [j] == i) {b = falso;} if (b) { a2 [a2.length] = i; return;}} setTimeOut ("run ()", 10);} </script> </head> <body> <div style = "Text-Align: Center; Margin-top: 100px; ancho: 100%;"> <Div id = "Show" style = "margin: auto; font-size: 50px; ancho: 100px; altura: 50px; fondos: #ffefeff"> </div> <div style = "margen-top: 20px;"> <input id = "bt" type = "botón" onclick = "action ()" valor = "inicio"/> </div> </div> </body> </html>