PHP expert |
|
*update: deselect mocht je nog niet door hebben
<script language="javascript">
function allSelect( form , element )
{
var Select = document.forms[form].elements[element];
for( var i = 0 ; i < Select.length ; i++ ) {
Select.options[i].selected = true;
}
}
function deSelect( form , element )
{
var Select = document.forms[form].elements[element];
for( var i = 0 ; i < Select.length ; i++ ) {
Select.options[i].selected = false;
}
}
</script>
<form name="myForm">
<select name="stations" multiple="multiple" size="3">
<option>first</option>
<option>second</option>
<option>third</option>
</select>
<br />
<input type="button" value="Select all" onClick="allSelect('myForm','stations');">
<input type="button" value="deselect all" onClick="deSelect('myForm','stations');">
</form>
<script language="javascript"> function allSelect( form , element ) { var Select = document.forms[form].elements[element]; for( var i = 0 ; i < Select.length ; i++ ) { Select.options[i].selected = true; } } function deSelect( form , element ) { var Select = document.forms[form].elements[element]; for( var i = 0 ; i < Select.length ; i++ ) { Select.options[i].selected = false; } } </script> <form name="myForm"> <select name="stations" multiple="multiple" size="3"> <option>first</option> <option>second</option> <option>third</option> </select> <br /> <input type="button" value="Select all" onClick="allSelect('myForm','stations');"> <input type="button" value="deselect all" onClick="deSelect('myForm','stations');"> </form>
mvg stijn
(beetje zoeken op het internet en documentatie vergaren en je geraakt er in 2 minuten)
[edit]
rofl en ik maar moeite doen , dankjewel dan |