JavaScript转义

xiaoxiao2021-02-28  76

下面这段代码那里错了?

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

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

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

转载请注明原文地址: https://www.6miu.com/read-79279.html

最新回复(0)