差距
Wednesday, 24. May 2006, 07:10:44
I hate IE forever.
Friday, 4. November 2005, 05:36:37
Table rows may be grouped into a table head, table foot, and one or more table body sections, using the THEAD, TFOOT and TBODY elements, respectively. This division enables user agents to support scrolling of table bodies independently of the table head and foot. When long tables are printed, the table head and foot information may be repeated on each page that contains table data.
简单来说,根据W3C HTML 4.0的规范,thead和tfoot是表头和表脚,它们始终出现在表格内容的头尾部。当一个很长的表格需要分页打印时,表头和表脚应该始终出现在每一页表格的头尾部。
现在我测试一下3种浏览器(Microsoft Internet Explorer、Opera、Mozilla Firefox)对这个规范的遵守程度:
在通常模式下浏览,三种浏览器几乎没有分别,它们都遵守了thead和tfoot始终在表格头尾的规范。但当我试图打印这个表格时问题出现了。
结论就是,三种浏览器都不尽如人意,Firefox相对表现最好,基本实现了W3C标准,IE除了没有实现thead和tfoot外表现也算正常,Opera的表现最差。
Wednesday, 26. October 2005, 02:36:18
http://dev.codelphi.com/virushuo/archive/2004/08/27/20311.aspx
本文的完成,需要感谢adex的帮助。
用firefox去看asp.net做的网站,一般是很不爽的。所有的内容都像被风吹晕了一样往左边斜。就像这样:

IE里面则是这样的:
以前我并没有在意过这个问题,总觉得是作页面的时候做得不好。(关于页面的知识我很bc,就算在意估计也不会有什么结果)。今天,同事Adex发现了这个 现象的原因--asp.net的服务器控件在不同的浏览器中render出来的结果是不一样的。在firefox和ie中分别是这样的:
<table id="panLogin" cellpadding="0" cellspacing="0" border="0" width="100%"> <div id="panLogin">这下清楚了,本来好好的div,在firefox中变成了table。怪不得无论如何都往左偏。
protected virtual HtmlTextWriterTag GetTagKey(string tagName)
{
if ((tagName != null) && (tagName.Length > 0))
{
object obj1 = HtmlTextWriter._tagKeyLookupTable[tagName.ToLower(CultureInfo.InvariantCulture)];
if (obj1 != null)
{
return ((HtmlTextWriterTag) obj1);
}
}
return HtmlTextWriterTag.Unknown;
} protected override string GetTagName(HtmlTextWriterTag tagKey)
{
if (tagKey == HtmlTextWriterTag.Div)
{
return "table";
}
return base.GetTagName(tagKey);
}明显,div被替换成了table。
比较长,我就不翻译了。
<case match="^Mozilla[^(]*\(compatible; MSIE <snip>">
browser=IE
...
tagwriter=System.Web.UI.HtmlTextWriter
</case><case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+ )?Netscape6/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">首先,这段正则表达式错了,firefox和mozilla5的useragent都没有包含Netscape6。然后,这段代码也没有让他们使用 HtmlTextWriter。也就是说,mozilla5/firefox只能得到html3.2的代码。
<!-- 2003-12-03, Rob Eberhardt - http://slingfive.com/demos/browserCaps/ -->
<browserCaps>
<!-- GECKO Based Browsers (Netscape 6+, Mozilla/Firebird, ...) //-->
<case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+)? (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">
browser=Gecko
type=${type}
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
tagwriter=System.Web.UI.HtmlTextWriter
<case match="rv:(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
version=${version}
majorversion=${major}
minorversion=${minor}
<case match="^b" with="${letters}">
beta=true
</case>
</case>
</case>
<!-- AppleWebKit Based Browsers (Safari...) //-->
<case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))">
browser=AppleWebKit
version=${version}
majorversion=${major}
minorversion=0.${minor}
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
tagwriter=System.Web.UI.HtmlTextWriter
<case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))( \(KHTML, like Gecko\) )?(?'type'[^/\d]*)/.*$">
type=${type}
</case>
</case>
<!-- Konqueror //-->
<case match = "Konqueror/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'));\w*(?'platform'[^\)]*)">
browser=Konqueror
version=${version}
majorversion=${major}
minorversion=${minor}
platform=${platform}
type=Konqueror
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
tagwriter=System.Web.UI.HtmlTextWriter
</case>
</browserCaps>
为了避免在每台机器上配置的麻烦,可以在项目的web.config中加入这段代码。试试看,是不是table变成div了?
题外话:这个错误有点弱智,我不太相信ms能犯这样的错误,其实我更倾向于相信这是故意的。要么就是他们真的认为除了IE,别的浏览器都不能正确的支持html4.0。殊不知,支持最差得反而是IE。
英文网站提到这个问题的很多,但中文的竟然一个没有。这是一件可怕的事情,可见中国的.net程序员眼中只有IE,没有其他浏览器。这是何等悲哀的事情。
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
| ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||
虎MM的BLOG,无限122~
老姐的BLOG
黄小强的BLOG
蒋郁的BLOG
喜欢Tifa不?喜欢就进!
想系统学习xhtml css的人必看
小毅
佳佳
陈力