正则表达
发布时间:2020-12-14 06:13:49 所属栏目:百科 来源:网络整理
导读:!DOCTYPE html html head ?title正则表达式/title ?meta charset="utf-8" ?style ?.input{ ??????????? width: 300px; ??????????? height: 40px; ??????????? font: 20px/40px ""; ??????????? margin: 200px 320px; ??????? } ??????? .input1{ ?????????
<!DOCTYPE html>
<html> <head> ?<title>正则表达式</title> ?<meta charset="utf-8"> ?<style> ?.input{ ??????????? width: 300px; ??????????? height: 40px; ??????????? font: 20px/40px ""; ??????????? margin: 200px 320px; ??????? } ??????? .input1{ ????????? ??????????? height: 40px; ??????????? font: 20px/40px ""; ??????????? margin: 200px -320px; ??????? } ??? .a{ ???????????? width: 120px; ???????????? height: 50px; ???????????? position: relative; ???????????? left: 300px; ???????????? font: 30px/50px ""; ???????? } ??? </style> ??? <script> ??? function 检测() ?{ ??var name=document.getElementsByTagName(‘name‘).value; ??var norms=/^[A-Za-z0-9]{1,6}/; ??
??if (norms.test(name))
??{ ???alert("OK"); ??} ??else ??{ ???alert("NO"); ??} ?} ?</script>? ? </head> <body> ?<label for="name" class="a">Name:</label> ??<input type="text" placeholder="不超过6个字符" name="name" id="name" class="input"> ??<input type="button" value="检测" onclick="检测()" class="input1"> ? ?
</body>
</html>
?
效果如下:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- c# – 无法将ADOX.Catalog.ActiveConnection设置为来自.NET
- ruby – 使用Nokogiri按名称查找节点
- Oracle 字符集的查看和修改
- 关于as3中implements、interface (接口)的意义
- actionscript-3 – 未找到类型或不是编译时常量1046
- Flex动态加载svg图片
- org.xmlpull.v1.XmlPullParserException: PI must not star
- cocos2dx 解决texture packer导出的图片程序中拼接有黑边的
- 今天发现listings包的跨页问题(2014-3-26)
- 使用xml来绘制简单的图像