Javascript 问题

最后用到好多javascript,看了看,好多IE,和Firefox的问题.
http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

Using Web Standards in Your Web Pages

"Browser makers are no longer the problem. The problem lies with designers and developers chained to the browser-quirk-oriented markup of the 1990s-often because they don't realize it is possible to support current standards while accommodating old browsers."

Web Standards Project

A number of elements and practices for adding DHTML to web pages were excluded from the W3C HTML 4.01 and Document Object Model (DOM) specifications. Elements like and collection of objects like document.layers[] (Netscape 4) or document.all (Internet Explorer 5+), for example, are actually not a part of any web standard. Browsers that comply with the W3C web standards, such as Firefox, Mozilla and Netscape 6/7, do not support these non-compliant elements and these proprietary DOM collections.

This article provides an overview of the process for upgrading the content of your web pages to conform to the W3C web standards. The various sections identify some practices which are at odds with the standards and suggest replacements. Every proposed web standards replacement in this article has been tested, verified and is working without a problem in modern browsers like MSIE 6, Netscape 7.x, Firefox 1.x, Opera 7+, Safari 1.2+, Konqueror 3.x, etc. The final section, Summary of Changes, outlines all the changes described in this article.

In this document:

  1. Upgrading Layer Elements (Netscape 4)
  2. Deprecated Elements
    1. Applet
    2. Font
    3. Other Deprecated
  3. Other Excluded Elements
  4. Using the W3C DOM
    1. Unsupported DOM-related Properties
    2. Accessing Elements with the W3C DOM
    3. Manipulating Document Style and Content
  5. Developing Cross Browser/Cross Platform Pages
    1. Browser identification approach: not best, not reliable
    2. Object/Feature detection approach: best, most reliable
  6. Summary of Changes

Upgrading Layer Elements (Netscape 4)

This section explains how to replace Netscape 4 and elements with standards-compliant HTML 4.01. Because and elements are not part of any W3C web standards, Netscape 6/7, Firefox and Mozilla and other browsers that comply with the W3C web standards do not support and elements.

The document.layers[] collection of objects and other specific features of the Netscape 4 Layer DOM are not supported either and are discussed the DOM section below.

In Netscape 4, elements are used primarly for 2 purposes:

  • to embed external HTML content inside a webpage and
  • to position a defined block of HTML content; such block of HTML content is usually named, referred as layer or DHTML layer by web authors, books and references.

Replacing and as embedded external HTML content

If you have:

 

... then you can for HTML 4.01 Transitional documents replace it with:

User agents and very old visual browsers which do not support IFRAME (like Netscape 4) will render its content: here, it is a link. In this manner, accessibility to content (content degradation) for older browsers is assured and is as graceful as it can be.

... or, for HTML 4.01 Strict documents, you can replace it with:


  Foo content

Again, the link will be rendered in user agents and browsers which do not support the object element, therefore assuring access to content.

The general accessibility strategy when using