-khj

 

 



<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../jquery-3.1.0.js" ></script>
<title></title>
<style type="text/css">
#txt{
border: 2px solid #90EE90;
font-size: 20px;
}
#txt2{
margin-top: 100px;
width: 200px;
height: 50px;
border: 2px solid blue;
text-align: center;
font-size: 25px;
}
#btn{
width: 200px;
height: 50px;
font-size: 40px;
font-weight: bold;

background-image: linear-gradient(pink,lightblue,lightgreen);

}
</style>
</head>
<body>
<textarea rows="5" cols="30" id="txt"></textarea><br>
<input type="button" name="btn" id="btn" value="验证" /><br>
<input type="text" name="" id="txt2" value="" />
</body>
</html>
<script type="text/javascript">

$(function(){

var txt =document.getElementById(\'txt\');
var txt2 = document.querySelector(\'#txt2\')
var btn =document.getElementById(\'btn\');

btn.onclick = function(){

var reg1 = /^\w{5,}@[a-z0-9]{2,3}\.[a-z]+$|\,$/;

if(reg1.test(txt.value))
{

txt2.value = \'验证成功!\'
var a1 = txt2.value
console.log(a1)
$(\'#txt2\').css(\'color\',\'blue\')
}
else
{
txt2.value = \'验证失败!\'
$(\'#txt2\').css(\'color\',\'red\')

}
}

})

</script>

分类:

技术点:

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-12-01
  • 2022-01-19
  • 2022-12-23
  • 2021-08-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-08
  • 2021-12-19
相关资源
相似解决方案