casinoweirdo
Technical User
I have the following code and I need to limit the amount of checkboxes to 5. Can anyone help me?
<script type="text/javascript">
function moveIt(numboxes) {
var boxes = new Array(numboxes)
clearSelect()
for (i = 0; i < numboxes ; ++i) {
if (document.forms['question2'].question2.checked == true) {
boxes = document.forms['question2'].question2.value
addOption(document.forms['question2'].question3, boxes, boxes, boxes)}
else {
boxes = document.forms['question2'].question2.value
addOption(document.forms['question2'].question4, boxes, boxes, boxes)
}
}
}
function addOption(selectbox,text,value ){
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
function clearSelect(){
while (document.forms['question2'].question3.options.length > 1) {
document.forms['question2'].question3.remove(1)}
while (document.forms['question2'].question4.options.length > 1) {
document.forms['question2'].question4.remove(1)
}
}
</script>
<form name="question2">
<table width="955">
<tr>
<td> <p class="MsoNormal">What 5 benefits seem to appeal to your customer the most?
(Please check 5 only)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Personal Host"> Personal Host</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Guaranteed value parking"> Guaranteed valet parking</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Food Discounts"> Food Discounts</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "VIP Lounge"> VIP Lounge</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "High percentage of cash back"> High percentage of cash back</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Free food"> Free food</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Bonus entries for drawings"> Bonus entries for drawings</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Priority seating in our food restaurants"> Priority seating in our food restaurants</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Free hotel stay"> Free hotel stay</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Cash back rewards using earned points"> Cash back rewards using earned points</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Online access to your account"> Online access to your account</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Monthly guaranteed comp hotel and food program"> Monthly guaranteed comp hotel and food program</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Invitations to exclusive special events"> Invitations to exclusive special events</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Upgrade to suite hotel comps"> Upgrade to suite hotel comps</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Hotel discount rates"> Hotel discount rates</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Monthly rewards based on level of play"> Monthly rewards based on level of play</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Gift shop discounts"> Gift shop discounts</p>
<br /><br />
<p class="MsoNormal">Of the above, what 1 benefit do you think your customers value the most?</p><br />
<select name="question3">
<option></option>
</select>
<p class="MsoNormal">What 1 benefit do you find lease appealing?</p><br />
<select name="question4">
<option></option>
</select>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
function moveIt(numboxes) {
var boxes = new Array(numboxes)
clearSelect()
for (i = 0; i < numboxes ; ++i) {
if (document.forms['question2'].question2.checked == true) {
boxes = document.forms['question2'].question2.value
addOption(document.forms['question2'].question3, boxes, boxes, boxes)}
else {
boxes = document.forms['question2'].question2.value
addOption(document.forms['question2'].question4, boxes, boxes, boxes)
}
}
}
function addOption(selectbox,text,value ){
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
function clearSelect(){
while (document.forms['question2'].question3.options.length > 1) {
document.forms['question2'].question3.remove(1)}
while (document.forms['question2'].question4.options.length > 1) {
document.forms['question2'].question4.remove(1)
}
}
</script>
<form name="question2">
<table width="955">
<tr>
<td> <p class="MsoNormal">What 5 benefits seem to appeal to your customer the most?
(Please check 5 only)</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Personal Host"> Personal Host</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Guaranteed value parking"> Guaranteed valet parking</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Food Discounts"> Food Discounts</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "VIP Lounge"> VIP Lounge</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "High percentage of cash back"> High percentage of cash back</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Free food"> Free food</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Bonus entries for drawings"> Bonus entries for drawings</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Priority seating in our food restaurants"> Priority seating in our food restaurants</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Free hotel stay"> Free hotel stay</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Cash back rewards using earned points"> Cash back rewards using earned points</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Online access to your account"> Online access to your account</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Monthly guaranteed comp hotel and food program"> Monthly guaranteed comp hotel and food program</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Invitations to exclusive special events"> Invitations to exclusive special events</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Upgrade to suite hotel comps"> Upgrade to suite hotel comps</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Hotel discount rates"> Hotel discount rates</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Monthly rewards based on level of play"> Monthly rewards based on level of play</p>
<p class="MsoNormal">
<input type="checkbox" name="question2" onclick=moveIt(17) value = "Gift shop discounts"> Gift shop discounts</p>
<br /><br />
<p class="MsoNormal">Of the above, what 1 benefit do you think your customers value the most?</p><br />
<select name="question3">
<option></option>
</select>
<p class="MsoNormal">What 1 benefit do you find lease appealing?</p><br />
<select name="question4">
<option></option>
</select>
</td>
</tr>
</table>
</form>