This article shares the specific code of JavaScript to implement the countdown of sending SMS for your reference. The specific content is as follows Implementation ideas: 1. js gets the send button element object Code example:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Send SMS</title> <style> .box { width: 360px; margin: 100px auto; } </style> </head> <body> <div class="box"> Mobile phone number: <input type="number"> <button>Send SMS</button> </div> <script> var btn = document.querySelector('button'); var time = 10; btn.addEventListener('click', function() { btn.disabled = true; var timer = setInterval(function() { if (time == 0) { // Clear the timer and restore the button clearInterval(timer); btn.disabled = false; btn.innerHTML = 'Send SMS'; time = 10; } else { btn.innerHTML = 'remaining' + time + 'seconds'; time--; } }, 1000); }); </script> </body> </html> Page effect: 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:
|
<<: Solve the problem of multiple listeners reported when starting tomcat in Idea
>>: How to migrate local mysql to server database
Shell Script #!/bin/sh # Current directory CURREN...
MySQL allows you to create multiple indexes on a ...
Copy the following code to the code area of Drea...
Enable WSL Make sure the system is Windows 10 200...
This article mainly introduces how to add floatin...
environment Hostname ip address Serve Jenkins 192...
The most important logs in the MySQL log system a...
1. Replace your .js library file address with the...
The query data in the xml price inquiry contains ...
Table of contents Nesting Parent-child component ...
How to implement the "Set as homepage" ...
Table of contents variable Data Types Extension P...
Table of contents Before MySQL 5.6 After MySQL 5....
How to view files in a docker image 1. If it is a...
Download and install. First check whether there i...