select all multiple-select box

G

grangey77

i would like to select all cases in a multiple select box by checking a check
box.

does anyone have any ideas?

thanks
 
G

grangey77

I have managed to create a solution to the problem.

You must call a function from an onclick function (e.g. onclick=
"selectall([name of selectbox])" of a checkbox. then you need to build a
function much like the one below:

function selectall(chosen)
{
var selObj = document.getElementById(chosen);
for (var i = 0; i < selObj.options.length; i++)
{
selObj.options.selected = true;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top