вторник, 14 октября 2008 г.

JavaScript in Drupal


Drupal includes built-in methods for implementing Javascript. Using these methods when you use Javascript will help to keep your code clean and to ensure compatibility with other modules' implementations.

A couple of simple principles guide Drupal's Javascript approach:

  • All pages should be perfectly functional without scripts. Javascript provides alternatives or supplements - not replacements - for standard elements.
  • No Javascript is hard-coded onto pages. Rather, actions are attached dynamically to page elements--and only if needed Javascript support is present.

See also the js developer API in the API section of the handbook.

Note: this section is currently being overhauled. The numbered subsections are the new content added to date - more to come very soon! The non-numbered subsections are old content that needs to be incorporated, updated or removed.