|
You need to populate the select box dynamically using pre-built arrays. For example,
var aBalls = new Array ("Basket Ball", "Football", "Tennis Ball");
var aTshirts = new Array ("Nike", "Addidas", "Fila");
Initially, you populate your select box with one set of values only.
Then, attach a function on the onClick event to the check-boxes. For example,
function hide(){
if(document.calc.tshirt.checked){
for(var i=0; i<aTshirts.length;i++){
document.calc.description.options[i]=new Option (aTshirts[i]);
}
}
if(document.calc.ball.checked){
for(var i=0; i<aBalls.length;i++){
document.calc.description.options[i]=new Option (aBalls[i]);
}
}
}
You are probably better off using radio buttons instead of check-boxes.
Hope this helps.
|