Hi,
I'm trying to make a <select> form object automatically select all of the values in it, when clicking on a link.
For example:
<select size="9" name="Categories" multiple>
<option value="5">bar</option>
<option value="2">bla bla bkl </option>
<option value="3">dum de dar da</option>
<option value="6">dghfgd</option>
<option value="4">foo</option>
<option value="1">test</option>
</select>
..and then the CheckAll() function would need to select all of the "options" inside the "select" input.
I have some code I've used before for "check-boxes", so they all get ticked - but this doesn't work for a SELECT field. For reference, here is the code that works with checkbox type elements:
function CheckAll (box) {
for (var i = document.editor_add.elements.length - 1; i >= 0; i--) {
document.editor_add.elements[i].checked = true;
}
}
</script>
Any suggestions?
TIA!
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
I'm trying to make a <select> form object automatically select all of the values in it, when clicking on a link.
For example:
Code:
<p>Categories: [ <a href="#" onclick="CheckAll();">select all</a> ]</p> <select size="9" name="Categories" multiple>
<option value="5">bar</option>
<option value="2">bla bla bkl </option>
<option value="3">dum de dar da</option>
<option value="6">dghfgd</option>
<option value="4">foo</option>
<option value="1">test</option>
</select>
..and then the CheckAll() function would need to select all of the "options" inside the "select" input.
I have some code I've used before for "check-boxes", so they all get ticked - but this doesn't work for a SELECT field. For reference, here is the code that works with checkbox type elements:
Code:
<script language="Javascript"> function CheckAll (box) {
for (var i = document.editor_add.elements.length - 1; i >= 0; i--) {
document.editor_add.elements[i].checked = true;
}
}
</script>
Any suggestions?
TIA!
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

