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 "ZEBRA B/W": ao(s, "YS 20\" - $19.09","YS 20\"", x++); ao(s, "YM 23\" - $19.09","YM 23\"", x++); ao(s, "YL 26\" - $19.09","YL 26\"", x++); ao(s, "AS 28\" - $19.09","AS 28\"", x++); ao(s, "AM 29\" - $19.09","AM 29\"", x++); ao(s, "AL 31\" - $19.09","AL 31\"", x++); ao(s, "AXL 33\" - $19.09","AXL 33\"", x++); ao(s, "A2XL 35\" - $21.19","A2XL 35\"", 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;