Classes
Members
(static) data :object
A cache for objects passed as argument of some
HTML element attribute.
We store an ID on the element,
and the data in such object
associated to that ID
Methods
(static) element(obj) → {object}
A function to instantiate the Html.Element
class without using the 'new' operator
Parameters
Name | Type | Description |
---|---|---|
obj |
object | The attributes / values to be applied to the HTML element |
Returns
An instance of the class Html.Element
passing the provided parameters to the
constructor
- Type
- object
(static) id() → {int}
Creates a 13 cyphers ID.
The first 5 cyphers are a random
integer,
and the following 8 cyphers
are the microtime (the current time
expressed in milliseconds) sliced
of the first 5 cyphers)
Returns
Returns a 13 cyphers ID
- Type
- int
(static) select_standard(obj) → {String}
Creates a standard select with standard and
custom properties.
Example
//returns a select element with the options listed in items
var html = Html.select_standard({
//default properties
name: 'friends'
,select_label: 'my friends'
,selected_item: ''
,select_one: true
,items: {
'Chiuini Shin': 'Paolo'
,'Bagration-Davitashvili': 'Mika'
,'Boissonnas': 'Rémi'
}
//any other attribute, e.g. style, class, data, id, ... (including custom attributes)
,onchange: 'friends_onchange(this)'
,style: ''
,'class': 'my_select'
});
document.write(html);
//the resulting HTML
<select name="friends" onchange="friends_onchange(this)" style="" class="my_select">
<optgroup label="my friends">
<option value="">[Select one]</option>
<option value="Chiuini">Paolo</option>
<option value="Bagration-Davitashvili">Mika</option>
<option value="Boissonnas">Rémi</option>
</optgroup>
</select>
Parameters
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
obj |
Object | An object with the following properties.
Properties
|
Returns
Returns the select element as plain html
- Type
- String
(static) table(obj) → {object}
A function to instantiate the Html.Table
class without using the 'new' operator
Parameters
Name | Type | Description |
---|---|---|
obj |
object | The attributes / values to be applied to the HTML element |
Returns
An instance of the class Html.Table
passing the provided object to the
constructor
- Type
- object