前台js将<>换成转意符

    在前台页面显示文本内容时,有时由于html标签的问题导致显示内容缺失,其实不是内容丢失了,只是因为内容以标签的形式显示了,而页面无法查看的原因,此时只需将文本内容中的'<'、'>'替换为对应的转义字符即可。

var str='aaabbbcccddd<cfd><act>1</act><num>tel:13800270309</num><mtype>0</mtype>';
str=str.replace(/[<>]/g,function(c){return {'<':'<','>':'>'}[c];

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<html> <head> <title>人员管理界面</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script> </head> <body> <div class="container"> <div class="row clearfix"> <div class="col-md-12 column"> <div class="page-header"> <h1> <small>员工列表 —— 显示所有员工信息</small> </h1> </div> </div> </div> <div class="row clearfix"> <div class="col-md-12 column"> <table class="table table-hover table-striped"> <thead> <tr> <th>ID</th> <th>姓名</th> <th>电话号</th> <th>地址</th> <th>职位</th> <th>职位编号</th> <th>状态</th> <th>证件照</th> </tr> </thead> <tbody> <c:forEach items="${employees}" var="employees"> <tr> <td>${employees.id}</td> <td>${employees.name}</td> <td>${employees.phonenumber}</td> <td>${employees.address}</td> <td>${employees.job}</td> <td>${employees.jobid}</td> <td>${employees.state}</td> <td><img src="${pageContext.request.contextPath}/images/${employees.pic}" style="width: 100px; height: 50px"></td> <td> <a href="${pageContext.request.contextPath}/toupdate/${employees.id}">更改</a> | <a href="${pageContext.request.contextPath}/delete/${employees.id}" onclick="return confirm('确定要删除吗?')">删除</a> </td> </tr> </c:forEach> </tbody> </table> </div> </div> </div> </body> </html>给这个界面的表格实现一个分页的功能,每页的最大数目为5
最新发布
06-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值