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 "095-DARK NAVY": ao(s, "AS - $28.09","AS", x++); ao(s, "AM - $28.09","AM", x++); ao(s, "AL - $28.09","AL", x++); ao(s, "AXL - $28.09","AXL", x++); ao(s, "A2XL - $29.29","A2XL", x++); ao(s, "A3XL - $30.49","A3XL", x++); ao(s, "A4XL - $31.59","A4XL", x++); ao(s, "A5XL - $32.79","A5XL", 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;