Hello,
I would like to extend or sub-class the base HTMLSelectEleme nt and add some
custom properties and methods. So far this works to create a new select
element.
var new_select= new Selector('new_s elect');
Selector = function(id) {
var container = document.getEle mentById(id);
selector = document.create Element("select ");
container.appen dChild(selector );
selector.id = id;
selector.name = id;
return selector;
}
but the prototype mentods are not showing up ...
Selector.protot ype.setOptions = function(option list) {
...
}
.... so this doesn't work: new_select.setO ptions(optionli st);
what would be the proper way do to this? Do I need to sub-class from a DOM
object that exposes a constructor to create elements (e.g.
Selector.protot ype = some_constructo r)?
Thanks,
Bill
I would like to extend or sub-class the base HTMLSelectEleme nt and add some
custom properties and methods. So far this works to create a new select
element.
var new_select= new Selector('new_s elect');
Selector = function(id) {
var container = document.getEle mentById(id);
selector = document.create Element("select ");
container.appen dChild(selector );
selector.id = id;
selector.name = id;
return selector;
}
but the prototype mentods are not showing up ...
Selector.protot ype.setOptions = function(option list) {
...
}
.... so this doesn't work: new_select.setO ptions(optionli st);
what would be the proper way do to this? Do I need to sub-class from a DOM
object that exposes a constructor to create elements (e.g.
Selector.protot ype = some_constructo r)?
Thanks,
Bill
Comment