Custom Select Box with link
The 'onchange' event doesn't fire when the select value is set programmatically. There is a 'click' event listener being set down in the code where the custom 'select' is being created. Add your open window code there.
Look for this line:
c.addEventListener("click", function(e) {
Then within the handler look for this line:
h.innerHTML = this.innerHTML;
And add whatever code you want to open the new window on the next line, for example:
window.open(s.value);
A more complete sample, using your code with that addition:
c.addEventListener("click", function(e) {
/*when an item is clicked, update the original select box,
and the selected item:*/
var i, s, h;
s = this.parentNode.parentNode.getElementsByTagName("select")[0];
h = this.parentNode.previousSibling;
for (i = 0; i < s.length; i++) {
if (s.options[i].innerHTML == this.innerHTML) {
s.selectedIndex = i;
h.innerHTML = this.innerHTML;
// *** This is the addition to open the window
window.open(s.value);
// **
break;
}
}
h.click();
});