当前位置:网站首页>节流函数的demo——正则表达式匹配
节流函数的demo——正则表达式匹配
2022-07-27 04:44:00 【勇敢*牛牛】
<!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>Document</title>
</head>
<body>
<form>
<input type="text"><br/>
<span>请输入</span>
</form>
<script> var input,flag,span; init(); function init(){
input = document.querySelector('input') span = document.querySelector('span') input.addEventListener('input',inputHandler); } function inputHandler(e){
if(flag) return flag = setTimeout(function(){
clearTimeout(flag); flag = undefined; disPaly(input.value); },500) } function disPaly(text){
if(text.match(/^1.+?0/)){
span.style.backgroundColor = 'green' span.innerHTML = '正确' }else{
span.style.backgroundColor = 'red' span.innerHTML = '错误' } } </script>
</body>
</html>
边栏推荐
- How to import PS style? Photoshop style import tutorial
- 如何将Photoshop图层复制到其他文档
- [error reporting] cannot read property 'parsecomponent' of undefined
- 【牛客讨论区】第七章:构建安全高效的企业服务
- How does PS import LUT presets? Photoshop import LUT color preset tutorial
- Sub database and sub table
- 事件的接受与忽略
- Huawei's entry into the commercial market: due to the trend, there are many challenges
- Sunset red warm tone tinting filter LUTS preset sunset LUTS 1
- strlen和sizeof的区别
猜你喜欢

UUID and indexing rules
![[search] connectivity model of DFS + search order](/img/67/40444e53621371b1c8b47f22ebc956.png)
[search] connectivity model of DFS + search order

How to do smooth data migration: Double write scheme

集成开发环境Pycharm的安装及模板设置

Dynamic routing configuration

2022 T2i text generated image Chinese Journal Paper quick view-1 (ecagan: text generated image method based on channel attention mechanism +cae-gan: text generated image technology based on transforme

Explanation of index failure principle and its common situations
![[search] - multi source BFS + minimum step model](/img/42/11b5b89153ab48d837707988752268.png)
[search] - multi source BFS + minimum step model

【Acwing】第61场周赛 题解

Huawei's entry into the commercial market: due to the trend, there are many challenges
随机推荐
C language - two dimensional array, pointer
Row, table, page, share, exclusive, pessimistic, optimistic, deadlock
日落红暖色调调色滤镜luts预设Sunset LUTs 1
kali系统arp介绍(断网嗅探密码抓包)
接口和抽象类/方法学习 demo
集成开发环境Pycharm的安装及模板设置
JS day 2 (variables, variable usage, naming rules, syntax extensions)
标准对话框 QMessageBox
Structural mode - adapter mode
使用Photoshop出现提示“脚本错误-50出现一般Photoshop错误“
Detailed explanation of mvcc and its principle
Knowledge about hash index and b+ tree
事件的接受与忽略
Digital integrated circuit: MOS tube device chapter (I)
What if Photoshop prompts that the temporary storage disk is full? How to solve the problem that PS temporary storage disk is full?
【C语言】自定义类型详解(结构体+枚举+联合)
When using Photoshop, the prompt "script error -50 general Photoshop error appears“
C language address book management system (linked list, segmented storage of mobile phone numbers, TXT file access, complete source code)
STL 上头系列——list 容器详解
【C语言】动态内存管理