[Previous] [Contents] [Next]

Action Sheets


Action sheets, or more properly, Cascading Action System (CAS), are Netscape's proposal for attaching behaviors to XML elements.

CAS works in two ways; for HTML an action sheet is attached to an element by using a minor extension of the Cascading Stylesheet (CSS) syntax. In the HTML code, you'd simply add another LINK element to point to the style sheet, like this:

<LINK REL="ActionSheet" TYPE="text/act" HREF="flip.act">

The behavior that you want to add to the page (or part of it) is encapsulated in the external script file flip.act, which can be in any language the browser can handle.

The elements that you want to have this behavior can simply be given the right class attribute, like this:

<P CLASS="flip">This paragraph will flip when you click on it<P>

For XML, Netscape proposes creating an action sheet as an XML document and then associating it with the target XML document in the same way as is currently done for CSS style sheets (using processing instructions as you saw on Days 13, "Viewing XML in Other Browsers" and 18, "Styling XML with CSS"). A typical action sheet could then look a little like the sketch shown in Listing 21.12.



Listing 21.12 A Template Action Sheet Document
1:  <!DOCTYPE actionsheet SYSTEM "asheet.dtd">
2:  <actionsheet>
3:
4:  <action type="text/cas" codetype="text/javascript">
5:  @import url(<http://purl.org/simonscripts/flip.cas>")
6:  .flip ( onMouseover: "flip(event)"; onMouseOut: "flop(event)")
7:  </action>
8:
9:  <script type="text/javascript" src="flip.js">
10: </script>
11:
12: <script type="text/javascript">
13: function flip(e) { ... }
14: function flop(e) { ... }
15: </script>
16: </actionsheet>

There are no implementations of action sheets yet.

[Previous] [Contents] [Next]