<div class="main">
<input id="userName" type="text" placeholder="请输入用户名">
<input id="rule" type="button" value="过滤">
</div>
html,body,div,input{margin:0;padding:0;}
.main{width:400px;height:auto;padding:0 15px;text-align:center;}
.main input{width:100%;height:35px;border:none;margin-top:20px;border-radius:5px;}
input[type="text"]{text-align:left;padding-left:15px;box-sizing:border-box;border:1px solid blue;}
input[type="button"]{width:50%;background:blue;}
@media only screen and (max-width: 415px) {
.main{width:100%;box-sizing:border-box;}
}
var userName = document.getElementById('userName'),
rule = document.getElementById('rule'),
regexEmpty = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
rule.onclick = function (){
userName.value = userName.value.replace(regexEmpty,''); //正则替换
console.log(userName.value);
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有