源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

ibm官方资料把应用程序从 Internet Explorer 迁移到 Mozilla第1/2页

  • 时间:2022-03-17 20:26 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:ibm官方资料把应用程序从 Internet Explorer 迁移到 Mozilla第1/2页
Netscape 最初开发 Mozilla 浏览器的时候,明智地决定支持 W3C 标准。因此,Mozilla 和 Netscape Navigator 4.x 以及 Microsoft Internet Explorer 遗留代码不完全向后兼容,比如后面将提到 Mozilla 不支持 [code]<layer>[/code]。Internet Explorer 4 这些在 W3C 标准的概念出现之前建立的浏览器继承了很多古怪之处。本文中将讨论 Mozilla 的特殊模式,它为 Internet Explorer 和其他遗留浏览器提供了强大的 HTML 向后兼容功能。 我还将讨论 Mozilla 支持的非标准技术,如 XMLHttpRequest 和富文本编辑,因为当时 W3C 还没有对应的标准。其中包括: [list] [*][url=http://www.w3.org/TR/html401/]HTML 4.01[/url] 和 [url=http://www.w3.org/TR/xhtml1/]XHTML 1.0/1.1[/url] [/*][*]级联样式表(CSS):[url=http://www.w3.org/TR/REC-CSS1]CSS Level 1[/url]、[url=http://www.w3.org/TR/REC-CSS2/]CSS Level 2[/url] 以及 [url=http://www.w3.org/Style/CSS/current-work.html]CSS Level 3[/url] 的部分。 [/*][*]文档对象模型(DOM):[url=http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/]DOM Level 1[/url]、 [url=http://www.w3.org/DOM/DOMTR#dom2]DOM Level 2[/url] 和 [url=http://www.w3.org/DOM/DOMTR#dom3]DOM Level 3[/url] 的部分 [/*][*]数学标记语言:[url=http://www.w3.org/Math/]MathML Version 2.0[/url] [/*][*]可扩展标记语言(XML):[url=http://www.w3.org/TR/REC-xml]XML 1.0[/url]、[url=http://www.w3.org/TR/REC-xml-names/]Namespaces in XML[/url]、[url=http://www.w3.org/TR/xml-stylesheet/]Associating Style Sheets with XML Documents 1.0[/url]、[url=http://www.w3.org/TR/2003/NOTE-xml-fragid-20030912/]Fragment Identifier for XML[/url] [/*][*]XSL 转换:[url=http://www.w3.org/TR/xslt]XSLT 1.0[/url] [/*][*]XML Path 语言:[url=http://www.w3.org/TR/xpath]XPath 1.0[/url] [/*][*]资源描述框架:[url=http://www.w3.org/RDF/]RDF[/url] [/*][*]简单对象访问协议:[url=http://www.w3.org/TR/SOAP/]SOAP 1.1[/url] [/*][*]ECMA-262 修订版 3(JavaScript 1.5):[url=http://www.ecma-international.org/publications/standards/Ecma-262.htm]ECMA[/url] [/*][/list] [url=http://www.ibm.com/developerworks/cn/web/wa-ie2mozgd/index.html#main][b]回页首[/b][/url] [url=http://www.w3.org/TR/REC-html40/sgml/entities.html]W3 标准体[/url] 专门作了规定。可以通过数字或者字符引用来引用这些实体。比如,可以用 #160 或者等价的字符引用 [code] [/code] 来引用空白字符 [code] [/code]。 一些旧式浏览器,如 Internet Explorer,有一些怪异的地方,比如允许用正常文本内容替换实体后面的分号([code];[/code]):
 
   Foo 
    Foo 
Mozilla 将把上面的 [code] [/code] 呈现为空格,虽然违反了 W3C 规范。如果后面紧跟着更多字符,浏览器就不能解析 [code] [/code],如:
 
  12345 
这样的代码在 Mozilla 中无效,因为违反了 W3 标准。为了避免浏览器的差异,应坚持使用正确的形式([code] [/code])。
[img]http://files.jb51.net/upload/20080415121213719.gif[/img] [img]http://files.jb51.net/upload/20080415121215781.gif[/img]
[img]http://files.jb51.net/upload/20080415121215781.gif[/img]
[img]http://files.jb51.net/upload/20080415121215580.gif[/img] [url=http://www.ibm.com/developerworks/cn/web/wa-ie2mozgd/index.html#main][b]回页首[/b][/url]
[url=http://www.ibm.com/developerworks/cn/web/wa-ie2mozgd/index.html#main][b]回页首[/b][/url] [url=http://www.ibm.com/developerworks/cn/web/wa-ie2mozgd/index.html#html_modes]严格呈现模式[/url],就会把字符串中的 [code]</script>[/code] 解释成外层 [code]<script>[/code] 的结束标签。下面的代码很好地说明了这一点:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
... 
<script> 
 document.write("<script>alert("Hello")</script>") 
</script> 
由于该页面采用严格模式,Mozilla 解析器就会看到第一个 [code]<script>[/code] 并解析它直到发现第一个结束标签,即第一个 [code]</script>[/code] 。这是因为解析器不知道 JavaScript(或者其他任何语言)何时采用严格模式。在特殊模式下,解析器在解析的过程中分析 JavaScript(因而降低了速度)。Internet Explorer 总是采用特殊模式,因此不真正支持 XHTML。为了在 Mozilla 中使用严格模式,需要将字符串分解成两部分:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
... 
<script> 
 document.write("<script>alert("Hello")</" + "script>") 
</script> 
[url=http://www.mozilla.org/projects/venkman/]http://www.mozilla.org/projects/venkman/[/url] 下载安装。还可以在开发页面上找到相关教程,开发页面的 URL 为 [url=http://www.hacksrus.com/~ginda/venkman/]http://www.hacksrus.com/~ginda/venkman/[/url]。 [url=http://www.1sucai.cn/article/14175_2.htm]2[/url][url=http://www.1sucai.cn/article/14175_2.htm]下一页[/url][url=http://www.1sucai.cn/article/14175_all.htm]阅读全文[/url]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部