Javascript Internet explorer文档模式它是如何工作的?
我有一个网页,它在IE7下工作得非常好。标题包含Javascript Internet explorer文档模式它是如何工作的?,javascript,internet-explorer,document,mode,Javascript,Internet Explorer,Document,Mode,我有一个网页,它在IE7下工作得非常好。标题包含 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 如果我把它们改成 Document mode - IE7 standards Browser mode - IE7 or IE8 它仍然不起作用 如果我把它改成 Document mode - IE8 Browser mode
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
如果我把它们改成
Document mode - IE7 standards
Browser mode - IE7 or IE8
它仍然不起作用
如果我把它改成
Document mode - IE8
Browser mode - IE8
然后页面显示良好
浏览器如何知道文档模式默认为IE7标准?既然页面在IE7中正确显示,那么为什么IE8不能在IE7浏览器模式下以IE7标准显示它呢?它应该充当IE7浏览器,对吗
谢谢
Zoltan如果指定
loose.dtd
,它将在IE8中启用“几乎标准模式”(IE7中没有类似的模式)。更改为strict.dtd
或-更好-只需使用
根据IE版本请求HTML 5和适当的
。
Document mode - IE8
Browser mode - IE8