Carey
|
| Posted: 03/17/2002, 3:57 AM |
|
I've got a nice page built, a grid form that allows me to delete records by checking a box(es). Could anyone tell me how to put a button in there that will check all check boxes on that page, and one to uncheck all?
Thanks!!
|
|
|
 |
Carey
|
| Posted: 03/17/2002, 7:52 AM |
|
I forgot to mention, these checkboxes on the grid are modeled after the article on this site. So, each checkbox has a different name. I'm thinking the solution has to incorporate javascript loops...but I don't know javascript! Help!
|
|
|
 |
Nicole
|
| Posted: 03/18/2002, 5:00 AM |
|
Carey,
To create ‘Select ALL’ (and if you want ‘Clear ALL’) links put following code inside html form:
<a href = "javascript:my_func1()">SelectAll</a>
<a href = "javascript:my_func2()">ClearAll</a>
and JavaScript is:
<script language = "JavaScript">
function my_func1()
{
var coll = document.all.tags("INPUT");
if (coll!=null)
{
for (i=0; i<coll.length; i++)
{
if (coll.type="checkbox")
coll.checked = true;
}
}
}
function my_func2()
{
var coll = document.all.tags("INPUT");
if (coll!=null)
{
for (i=0; i<coll.length; i++)
{
if (coll.type="checkbox")
coll.checked = false;
}
}
}
</script>
|
|
|
 |
Carey
|
| Posted: 03/18/2002, 2:45 PM |
|
Thanks, Nicole!
It works, but not without error. It says it can't get the "type" property, as it's not supported. However, after clearing that error, I see that it is working. How can I get around the error dialog box?
Much appreciated!
|
|
|
 |
|