PHP ver gevorderde |
|
ok bedankt want ik heb nu alles wat ik nodig heb, ik ben ondertussen op zoek geweest op google en vond uiteindelijk precies wat ik zocht:
<script>
function Move(pSelectBox, pOffset){
var targetOption = pSelectBox.selectedIndex + pOffset;
if(targetOption > -1 && targetOption <pSelectBox.options.length){
pSelectBox.selectedIndex = targetOption;
}
}
</script>
...
<form id="myForm" name="myForm">
<select id="mySelect" name="mySelect" size="5" style="width: 100px">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</select>
<input type="button" onclick="Move(this.form.mySelect, -1);" value="up" />
<input type="button" onclick="Move(this.form.mySelect, 1);" value="down" />
</form>
<script> function Move(pSelectBox, pOffset){ var targetOption = pSelectBox.selectedIndex + pOffset; if(targetOption > -1 && targetOption <pSelectBox.options.length){ pSelectBox.selectedIndex = targetOption; } } </script> ... <form id="myForm" name="myForm"> <select id="mySelect" name="mySelect" size="5" style="width: 100px"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> </select> <input type="button" onclick="Move(this.form.mySelect, -1);" value="up" /> <input type="button" onclick="Move(this.form.mySelect, 1);" value="down" /> </form>
dus dat was nog het enige wat ik nodig had;-) |