This page was last modified 07:15, 28 March 2008.
Use prototype javascript library : basic operations (utility functions, etc) in WRT application
From Forum Nokia Wiki
Contents |
Introdution
As you may know, Prototype is a famous cross-web-browser javascript library. It supports almost all current popular web browsers, such as FireFox, Safari, IE, Opera, etc. With the latest version(Prototype 1.6.0), it also supports AppleWebKit, an open source web engine provided by Apple Inc.
The Nokia Web Browser is built upon S60WebKit, a port of the open source WebKit project to the S60 platform. Nokia WRT(Web-RunTime) is based on it.
In this section, we will see how to do basic operations(utility functions) using prototype library[1].
Basic operations (Utility functions, etc)
Here is a list of the basic operations (dollar functions) provided by prototype library:
- $() -- returns the element that has the id passed as an argument
- $$() -- returns the elements that match CSS selectors
- $A() -- converts the single argument it receives into an Array object.
- $F() -- returns the value of any field input control
- $H() -- converts objects into enumerable Hash objects that resemble associative arrays
- $R() -- builds a range object.
- $w() -- Splits a string into an Array, treating all whitespace as delimiters. Equivalent to Ruby's %w{foo bar} or Perl's qw(foo bar).
For detailed explanations of these functions, please go to http://prototypejs.org/api/utility
All of the above functions are tested in the example WRT application of this topic. For the convenience, the related source code of each test case is displayed in UI, and formatted by prettyprint.js for a better look.
All test cases of the above functions passed. The Try.these function is not tested, you can try it yourself.
Most of the examples(cases) come from this guidance: http://www.sergiopereira.com/articles/prototype.js.html (You may notice this guide is a note for prototype1.5.0, but it doesn't matter.)
The next topic will be String manipulations.
Download Sample Widget
Download sample wiget of this topic: Image:PrototypeBasicDemo.zip. To install it, just rename the suffix .zip to .wgz.
For the latest version, please go to http://code.google.com/p/prototypewrt/downloads/list
Related topics
- Use prototype javascript library : Summary in WRT application
- Use prototype javascript library : basic operations (Utility fucntions, etc) in WRT application
- Use prototype javascript library : string manipulation in WRT application
- Use prototype javascript library : Object Creation in WRT application
- Use prototype javascript library : Prototype UI in WRT application
- Use prototype javascript library : Form and AJAX(JSON) in WRT application
References
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java on PC reading sms messsage on Nokia mobile | loshdo | PC Suite API and PC Connectivity SDK | 1 | 2005-08-04 17:37 |
| Problem with PrepareLC() in CAknNoteDialog | sohan | Symbian User Interface | 15 | 2007-04-13 07:14 |
| Оффтоп | Cagemts | Russian Developer Forum - Форум Российских разработчиков | 96 | 2008-05-06 07:16 |
| JavaScript problem | arunoday | Browsing and Mark-ups | 2 | 2002-08-16 05:43 |
| JavaScript problem | arunoday | Browsing and Mark-ups | 2 | 1970-01-01 02:00 |
