function ao(c,txt,val,idx){ c.options[idx] = new Option(txt,val); } function setSizes(c, s){ var id; var x=0; var opt; if (!s || !c) return; if (c.selectedIndex < 1){ clearSizes(); return; } id = c.options[c.selectedIndex].value; s.options.length = 0; opt = new Option('Please select a size', ''); s.options[x++] = opt; switch(id){ case "BLACK/WHITE": ao(s, "10","10", x++); ao(s, "10.5","10.5", x++); ao(s, "11","11", x++); ao(s, "11.5","11.5", x++); ao(s, "12","12", x++); ao(s, "5","5", x++); ao(s, "5.5","5.5", x++); ao(s, "6","6", x++); ao(s, "6.5","6.5", x++); ao(s, "7","7", x++); ao(s, "7.5","7.5", x++); ao(s, "8","8", x++); ao(s, "8.5","8.5", x++); ao(s, "9","9", x++); ao(s, "9.5","9.5", x++); break; } } function initSizes (){ var s, c, f=document.frmOrder; if ( !f ) return; s = f.sizes; c = f.colors; if (!c || !s) return; if (c.selectedIndex > 0){ setSizes(c, s); } else { s.options.length = 0; var opt = new Option('Please select a color first', ''); s.options[0] = opt; } } function clearSizes (){ var s, c, f=document.frmOrder; if ( !f ) return; s = f.sizes; c = f.colors; if (!c || !s) return; if (c.selectedIndex > 0) return; s.options.length = 0; var opt = new Option('Please select a color first', ''); s.options[0] = opt; } window.onload = initSizes;