Select All/None Select List

[Total: 0    Average: 0/5]

This example shows how to select all or none of the items in a select list.

Body Code:

<form action="" name="exf1">
<select name="s1" size="4" multiple>
    <option value="one">One
    <option value="two">Two
    <option value="three">Three
    <option value="four">Four
</select>
<input type="button" value="select all" onclick="selAll(true)">
<input type="button" value="select none" onclick="selAll(false)">
</form>
<script>
function selAll(_v) {
for(var i=0;i<document.exf1.s1.length;i++)
  document.exf1.s1[i].selected=_v;
}
</script>

Times Viewed: 7

Leave a Reply

Your email address will not be published. Required fields are marked *