【问题标题】:How to fix error "reference to entity "orderby" must end with the ';' delimiter"?如何修复错误“对实体“orderby”的引用必须以';'结尾分隔符”?
【发布时间】:2017-02-02 23:22:17
【问题描述】:

我试图让滑块显示我博客帖子中的最新帖子。我已经放置了以下脚本,但得到:

对实体“orderby”的引用必须以“;”结尾分隔符

这是我的代码:

<script>
document.write(" <script src='\"/feeds/posts/default?max-results=5&orderby=published&alt=json-in-script&callback=showrecentposts6\"'><\/script>");
</script>

【问题讨论】:

  • 能否请您在脚本中显示完整的代码
  • 你为什么使用document.write?为什么不只为/feeds/posts/default?... 添加一个&lt;script&gt; 标签?

标签: javascript html


【解决方案1】:

&amp;amp;HTML中的特殊字符:

字符引用必须以 U+0026 AMPERSAND 字符 (&) 开头。

因此,当您只想要&amp;amp; 时,您应该将其转义为

&amp;

但是,您不应该收到该错误。 The parser should tolerate &amp;amp; 而不是 &amp;amp; 当不可能使用字符引用时:

尝试使用字符引用,不允许额外 字符。

如果没有返回任何内容,则发出 U+0026 AMPERSAND 字符 (&) 标记。

It would really be an error in XML:

& 符号 (&) 和左尖括号 (

但是,you can't use document.write in XML:

如果在 XML 文档上调用该方法,则抛出一个 InvalidStateError 异常并中止这些步骤。

【讨论】:

    猜你喜欢
    • 2019-10-04
    • 1970-01-01
    • 2011-07-05
    • 2011-09-22
    • 2014-05-26
    • 2012-12-16
    • 2010-12-29
    • 2020-07-14
    相关资源
    最近更新 更多