17. WCSS Access Key Extension

17.1. Specifying Keypad Shortcuts for Elements (-wap-accesskey Property)

Preferences - Do not show ads

Only one WCSS property, -wap-accesskey, is included in the access key extension. The -wap-accesskey property is used to specify a keypad shortcut for an XHTML MP element. Valid property values are *, #, 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

Here are some WAP CSS examples:

  • a.wcss_class_1 {-wap-accesskey: 1}

  • input.wcss_class_1 {-wap-accesskey: 4}

  • a.wcss_class_2 {-wap-accesskey: *}

  • input.wcss_class_2 {-wap-accesskey: #}

Note: Specifying directly the * and # characters to a property actually violates the CSS2 (and thus WAP CSS) syntax. To follow the CSS2 syntax, you have to use Unicode escape sequences instead. The Unicode escape sequences of * and # are \2a and \23 respectively. Examples: "-wap-accesskey: \2a", "-wap-accesskey: \23". However, in practice, some WAP browsers (e.g. some Sony Ericsson WAP browsers) require the form "-wap-accesskey: \2a" and "-wap-accesskey: \23", while some others (e.g. Openwave Mobile Browser 6.2.2) require the form "-wap-accesskey: *" and "-wap-accesskey: #".

If you read our XHTML MP tutorial, you will remember that some XHTML MP tags such as <a> and <input> contain the accesskey attribute that can also help you define a shortcut key in mobile phone browsers. You can achieve the same outcome by using either the -wap-accesskey property or the accesskey attribute. If the -wap-accesskey property is applied to an XHTML MP tag of which the accesskey attribute has been specified, the -wap-accesskey property value will override the accesskey attribute value.

In XHTML MP, only four elements (<a>, <input>, <label> and <textarea>) contain the accesskey attribute. If you apply the -wap-accesskey style to any element other than these four, there will be no effect when the keypad shortcut is pressed. For example, let's say you specify the WCSS style statement "p {-wap-accesskey: 1}" in a cascading style sheet. Nothing will happen if you press the "1" key of the keypad.

Previous Page Page 25 of 39 Next Page

Contents at a Glance (Click Here for Full Table of Contents)
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?

WCSS Tutorial Table of Contents WCSS Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page