【发布时间】:2021-09-26 04:34:52
【问题描述】:
我在一篇关于字符编码的文章中看到了这段代码 sn-p。
<html>
<body>
<style type="text/css">p {float: left; padding: 0 15px; margin: 0; font-size: 80%;}</style>
<script type="text/javascript">
for (var i=0; i<128; i++) document.writeln ((i%32?’:'<p>') + i + ': ' + String.fromCharCode (i) + '<br>');
</script>
</body>
</html>
该代码应该输出指定范围内的所有 ASCII 字符。
在 for 循环体中,在 writeln 函数中,模条件后面有一个撇号。我不明白撇号是什么意思。我将它复制到我的文本编辑器并将其保存为 HTML 文件,但它不会在我的浏览器上呈现任何内容。它会在控制台Uncaught SyntaxError: Invalid or unexpected token 中产生语法错误。
这是文章的链接 - https://www.smashingmagazine.com/2012/06/all-about-unicode-utf8-character-sets/
【问题讨论】:
标签: html