JavaScript转义

常见问题 智学无忧-老曹

下面这段代码那里错了?

  <script>
        document.write("<script> alert('')  </script>");
    </script>



错误原因:字符串的</script>会被解释为与外面的<script>标签匹配,所以需要对 转义\/

   <script>
        document.write("<script> alert('')  <\/script>");
    </script>

还能输出{{restrictNumber}}个字符  
  • {{reply.author}}

    {{CommonUtil.formateDate(reply.ac_CommentDate).shortTime}}
  • 回复了{{Comments.author}} :