1HTML::Prototype::Js(3)User Contributed Perl DocumentationHTML::Prototype::Js(3)
2
3
4
6 HTML::Prototype::Js - prototype library, embedded in perl
7
9 our $prototype = do { package HTML::Prototype::Js; local $/; <DATA> };
10
12 This is the actual Prototype library embedded in a perl __DATA__
13 section, for easy inclusion in HTML::Prototype.
14
16 The prototype library provides some functions and classes which
17 effectively change the basic syntax of the JavaScript you write.
18
19 $(element)
20 This function takes an element / element list and gets all string
21 elements using document.getElementbyId. This is probably one of the
22 most common functions when using javascript for web development, so
23 it will save you a lot of typing.
24
25 Class
26 This uses fucntion references to allow namespace-like Class
27 structures in javascript.
28
29 Object.extend
30 Simple inheritance for javacsript. Will set all properties of the
31 child in the parent.
32
33 Function.bind
34 Allow function refs to be full object method references, through
35 the use of extend and apply
36
37 Try.these
38 Simple try/catch for a list of functions, will return the return
39 value of the first that doesn't throw an exception.
40
41 Array.push
42 implement push for arrays. returns number of elements in result.
43
44 Function.apply
45 Call a function on a given object, using eval.
46
48 The Prototype library provides a number of classes you can use to
49 improve interaction with the end user.
50
51 Ajax
52 Provides one useful function, getTransport. This function will
53 return a XMLHttpRequest object suitable for your browser.
54
55 Ajax.Base
56 An abstract base class for the Ajax objects described below. Sets
57 some common options for Ajax objects;
58 method: http method, defaults to post.
59 asynchronous: process in the background, true/false, defaults to
60 true.
61 parameters: extra parameters, defaults to blank.
62
63 Ajax.Updater
64 a subclass of Ajax.Base, this class uses Ajax.Request to populate a
65 container in your web page. Takes container, url and Ajax.Base
66 options as paramters.
67
68 Ajax.Request
69 This object represents a plain ajax request. It extends base to add
70 a constructor, as well as some events to handle events. The
71 constructor takes an url, as well as the options described in
72 Ajax.Base. Currently handles the following events:
73 'Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'
74
75 Effect.Appear
76 Takes an element, and makes that element appear through a fade.
77
78 Effect.ContentZoom
79 Takes an element, and zooms the content of that element.
80
81 Effect.Fade
82 Takes an element, and makes that element fade out and disappear.
83
84 Effect.Highlight
85 Takes an element, and does a highlight of that element.
86
87 Effect.Puff
88 Takes an element, and makes that element "blow up" and disappear.
89 (As in disappear in a puff of smoke).
90
91 Effect.Scale
92 Takes an element, and a size, in percent, and scales that element
93 to the given size. If it's a div, the initial size will have to be
94 given in EM. No such restrictions for pictures.
95
96 Effect.Squish
97 Takes an element, and shrinks that element until it disappears.
98
99 Element
100 A collection of functions related to basic elements. takes one or
101 more elements.
102 toggle: Toggles the element display style.
103 hide: Turns off the element's display style.
104 show: Turns on the element's display style.
105 remove: Delete this element from the DOM.
106 getHeight: Get the element height.
107
108 Also provides a convenience object, Toggle, with one method display
109 which aliases to toggle, so you can call it as
110 Toggle.display(element)
111
112 Field
113 Adds some useful functions to HTML Fields with several elements:
114 clear: remove all content.
115 focus: Give the element focus.
116 present: returns true if all arguments are filled in, false
117 otherwise.
118 select(element): Select the given element in a form.
119 activate(element): give the selected element focus, and select
120 it.
121
122 Form
123 Some useful utilies for HTML Forms. all of these take a form
124 element as sole argument.
125 serialize: returns a URL serialized version of a given form.
126 getElements: returns all elements in the form.
127 disable: blurs and disables every element in the form.
128 focusFirstElement: Give first element in the form focus.
129 reset: reset all form elements.
130
131 Form.Element
132 Some useful objects for Form Field Elements. These take an element
133 as the sole argument.
134 serialize: url encode the element for use in a URI string.
135 getValue: returns the value of the given element.
136
137 Form.Element.Observer
138 Form.Element.Serializers
139 Serializers for various element types. Takes the input element as
140 argument.
141 input: determines the element type, and chooses the right
142 serializer.
143 inputSelector: serialize checkbox/radio.
144
145 Form.Element.Observer
146 Insertion
147 This can be used in place of a innerHTML, to insert the content
148 into the dom.
149
150 Insertion.Before
151 Puts content before a given dom node.
152
153 Insertion.Top
154 Puts content at the top of a given dom node.
155
156 Insertion.Bottom
157 Puts content at the bottom of a given dom node.
158
159 Insertion.After
160 Puts content after a given dom node.
161
162 PeriodicalExecuter
163 This object takes two parameters, a reference to a callback
164 function, and a frequency in seconds. It will execute the callback
165 every <frequency> second.
166
168 HTML::Prototype, Catalyst::Plugin::Prototype
169 <http://prototype.conio.net/>
170
172 Sebastian Riedel, "sri@oook.de" Marcus Ramberg, "mramberg@cpan.org"
173
174 Built around Prototype by Sam Stephenson. Much code is ported from
175 Ruby on Rails javascript helpers.
176
178 This library is free software. You can redistribute it and/or modify it
179 under the same terms as perl itself.
180
181
182
183perl v5.38.0 2023-07-20 HTML::Prototype::Js(3)