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 "RED": ao(s, "7.5\" WIDE X 5\" HIGH X 3\" DEEP - $14.29","7.5\" WIDE X 5\" HIGH X 3\" DEEP", x++); ao(s, "9\" WIDE X 8\" HIGH X 4\" DEEP - $18.09","9\" WIDE X 8\" HIGH X 4\" DEEP", x++); break; case "ROYAL BLUE": ao(s, "7.5\" WIDE X 5\" HIGH X 3\" DEEP - $14.29","7.5\" WIDE X 5\" HIGH X 3\" DEEP", x++); ao(s, "9\" WIDE X 8\" HIGH X 4\" DEEP - $18.09","9\" WIDE X 8\" HIGH X 4\" DEEP", x++); break; case "LIGHT PINK": ao(s, "7.5\" WIDE X 5\" HIGH X 3\" DEEP - $14.29","7.5\" WIDE X 5\" HIGH X 3\" DEEP", x++); ao(s, "9\" WIDE X 8\" HIGH X 4\" DEEP - $18.09","9\" WIDE X 8\" HIGH X 4\" DEEP", x++); break; case "TROPICAL BLUE": ao(s, "7.5\" WIDE X 5\" HIGH X 3\" DEEP - $14.29","7.5\" WIDE X 5\" HIGH X 3\" DEEP", x++); ao(s, "9\" WIDE X 8\" HIGH X 4\" DEEP - $18.09","9\" WIDE X 8\" HIGH X 4\" DEEP", x++); break; case "FUCHSIA": ao(s, "7.5\" WIDE X 5\" HIGH X 3\" DEEP - $14.29","7.5\" WIDE X 5\" HIGH X 3\" DEEP", x++); ao(s, "9\" WIDE X 8\" HIGH X 4\" DEEP - $18.09","9\" WIDE X 8\" HIGH X 4\" DEEP", 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;