select-element.js
721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* globals modulejs */
modulejs.define('SelectElement', function() {
'use strict';
function SelectElement(name, id) {
this.select = document.createElement("select");
}
SelectElement.prototype.setAttr = function(attr, value) {
return this.select.setAttribute(attr, value);
};
SelectElement.prototype.addOption = function(option) {
return this.select.add(option);
};
SelectElement.prototype.getSelect = function() {
return this.select;
};
SelectElement.generateOption = function(value, text) {
var option;
option = document.createElement("option");
option.setAttribute("value", value);
option.text = text;
return option;
};
return SelectElement;
});