我只是檢查是否有效,將元素放置在<noscript>
元素內作爲回退以顯示動態內容。它驗證罰款與HTML 5的文檔類型,但是對於HTML 4.01,我得到以下錯誤:爲什麼不會<iframe>元素在HTML 4.01中驗證?
Line 9, Column 35: element "IFRAME" undefined
<iframe name="test" src="test.htm"></iframe>You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:
- incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "" element),
- by using vendor proprietary extensions such as "" or "" (this is usually fixed by using CSS to achieve the desired effect instead).
- by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case).
這是我削成HTML到:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>I AM YOUR DOCUMENT TITLE REPLACE ME</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div>
<iframe name="test" src="test.htm"></iframe>
</div>
</body>
</html>
的元素定義以下網址的HTML 4.01規範:http://www.w3.org/TR/html401/present/frames.html#h-16.5。
它通過一個過渡文檔類型,所以我想我的問題是「爲什麼它不允許嚴格的文檔類型,即使它在規範中定義?」。
可能在嚴格的DTD中無效。你可以轉移到Transitional嗎? – Craig 2011-02-02 10:55:20
@Craig:根據W3Schools,沒關係,但那也是我第一次嘗試。 – Mikaveli 2011-02-02 11:00:57