js姓名星号加密,姓氏*号,身份证号出生日期星号加密
程序员文章站
2022-03-09 07:50:08
js姓名星号加密,姓氏*号,身份证号出生日期星号加密HTML
- 【标题】知不知对你牵上万缕爱意<...2020-12-29
js姓名星号加密,姓氏*号,身份证号出生日期星号加密
- HTML
<div class="huifu panel-body">
<ul>
<li class="huifuli">
<div class="huifubt">【标题】知不知对你牵上万缕爱意
<div style="float:right;">2020-12-29</div>
</div>
<div class="huifuxx">
留言人:<span class="huifuname">孙耀威</span>
身份证号:<span class="huifusfh">381729199804264761</span>
</div>
</li>
<li class="huifuli">
<div class="huifubt">【标题】是否爱上一个人 不问明天过后
<div style="float:right;">2020-12-29</div>
</div>
<div class="huifuxx">
留言人:<span class="huifuname">张杰</span>
身份证号:<span class="huifusfh">294763199804262691</span>
</div>
</li>
</ul>
</div>
- CSS
<style>
*{ padding:0; margin:0;}
.tongji {
width: 900px;
margin-top: 40px;
line-height: 2.0;
margin-left: auto;
margin-right: auto;
box-shadow: 8px 8px 6px #888888;
}
.huifu {
width: 900px;
margin-top: 40px;
line-height: 2.0;
margin-left: auto;
margin-right: auto;
}
.huifu .huifuli {
width: 100%;
height: 100px;
padding: 8px;
}
.huifubt {
width: 100%;
font-size: 18px;
font-weight: bold;
height: 50px;
line-height: 50px;
color: #13438b;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.huifuxx {
height: 40px;
line-height: 40px;
color: #75a5cc;
font-size: 14px;
border-bottom: 1px solid #d2d2d2;
width: 100%;
}
.tjbg tr:nth-child(3) {
display: none;
}
</style>
- JS
<script>
//名字星号
var huifuname=document.getElementsByClassName("huifuname");
for(var i=0;i<huifuname.length;i++){
huifuname1= huifuname[i].innerText;
var huifuname2 = huifuname1.substr(1,huifuname1.length);
var huifuname3 = '* '+huifuname2;
document.getElementsByClassName('huifuname')[i].innerText=huifuname3;
}
//身份号加密
var huifusfh=document.getElementsByClassName("huifusfh");
for(var i=0;i<huifusfh.length;i++){
huifusfh1= huifusfh[i].innerText;
var huifusfh2 = huifusfh1.substr(0,6);
var huifusfh3 = huifusfh1.substr(14,4);
var huifusfh4 = huifusfh2 + ' **** ' + huifusfh3;
document.getElementsByClassName('huifusfh')[i].innerText=huifusfh4;
}
</script>
加密前:
加密后:
本文地址:https://blog.csdn.net/zhangjie2016/article/details/111919917
上一篇: 圣诞节礼物篇,给你一个大大的惊喜
下一篇: DB2编程序技巧 (六)