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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
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
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!