Html firebug 在 doctype 中返回语法错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7714896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:02:06  来源:igfitidea点击:

firebug returns syntax error in doctype?

htmlfirebug

提问by clarkk

Why does Firebug return an error in my doctype?

为什么 Firebug 在我的文档类型中返回错误?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> 

error

错误

syntax error
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 

source code

源代码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
.....

回答by Quentin

This usually happens because you are loading an HTML document as a script. This is often caused by <script src=""></script>(i.e. a relative URI pointing at the current, HTML, document)) or one of the scripts pointing to a 404 error.

这通常是因为您将 HTML 文档作为脚本加载。这通常是由 <script src=""></script>(即指向当前、HTML、文档的相对 URI))或指向 404 错误的脚本之一引起的。

回答by James Williams

DOCTYPE normally is expressed on one line like below. and can cause syntax error

DOCTYPE 通常用如下一行表示。并可能导致语法错误

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

But even sometimes it will yell about a syntax error when a src attribute is not declared for an element. Firebug can also through this error when a source is not found or is called twice on one page. EX: script/image/link.

但即使有时它会在未为元素声明 src 属性时大喊语法错误。当找不到源或在一页上调用两次时,Firebug 也可以通过此错误。例如:脚本/图像/链接。