*/
js_add_preset: function(ptr) {
var option = document.createElement("option");
- option.value = Pointer_stringify(ptr);
- option.innerHTML = Pointer_stringify(ptr);
+ option.value = gametypeoptions.length;
+ option.appendChild(document.createTextNode(Pointer_stringify(ptr)));
gametypeselector.appendChild(option);
gametypeoptions.push(option);
},
* dropdown.
*/
js_get_selected_preset: function() {
- var val = 0;
for (var i in gametypeoptions) {
if (gametypeoptions[i].selected) {
- val = i;
- break;
+ return gametypeoptions[i].value;
}
}
- return val;
+ return 0;
},
/*
var options = [];
for (var i in items) {
var option = document.createElement("option");
- option.value = items[i];
- option.innerHTML = items[i];
+ option.value = i;
+ option.appendChild(document.createTextNode(items[i]));
if (i == initvalue) option.selected = true;
dropdown.appendChild(option);
options.push(option);
var val = 0;
for (var i in options) {
if (options[i].selected) {
- val = i;
+ val = options[i].value;
break;
}
}