This article shares the specific code of js to implement random roll call for your reference. The specific content is as follows Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> div:nth-child(1) { width: 200px; height: 100px; background-color: burlywood; text-align: center; line-height: 100px; } div:nth-child(2) { width: 100px; height: 100px; background-color: pink; border-radius: 50%; text-align: center; line-height: 100px; } </style> </head> <body> <div>Liu Zhiyuan</div> <div>Begin</div> <script> var div = document.getElementsByTagName('div'); var btn = document.getElementsByTagName('button')[0]; username() function username() { var flag = false; var timerId = null; // console.log(div); : : : : : : : : : : : : : : : div[1].onclick = function() { if (flag) { clearInterval(timerId); div[1].innerHTML = 'Stop' flag = false; } else { timerId = setInterval(function() { var re = Math.floor(Math.random() * arr.length); console.log(re); div[0].innerHTML = arr[re]; }, 60); div[1].innerHTML = 'start' flag = true; } } } </script> </body> </html> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Solution to the welcome to emergency mode message when booting CentOS7.4
>>: MySQL 5.7.17 installation and configuration method graphic tutorial (windows10)
1. px px is the abbreviation of pixel, a relative...
Web design, according to personal preferences and ...
Table of contents Storage Engine Memory Managemen...
I can log in to MYSQL normally under the command ...
1. What is positioning? The position attribute in...
1. Check the synchronization status of A and B da...
There are two versions of MySQL database manageme...
This is my first time using the element framework...
The first step is to install TypeScript globally ...
Unlike other types of design, web design has been ...
How to delete environment variables in Linux? Use...
The usage format of the mysqladmin tool is: mysql...
1. CSS element hiding <br />In CSS, there ar...
I have seen a lot of MySQL-related syntax recentl...
This article shares the MySQL precompilation func...