SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    select all checkboxes?

    here's a quick question:

    how do i have a link to select all the checkboxes on a certain page?

    thanks in advance

  2. #2
    SitePoint Member doggi's Avatar
    Join Date
    Oct 2001
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    Code:
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    <META NAME="Generator" CONTENT="TextPad 4.4">
    <META NAME="Author" CONTENT="?">
    <META NAME="Keywords" CONTENT="?">
    <META NAME="Description" CONTENT="?">
    <SCRIPT language="javascript">
    <!--
    function doIt()
    {
    	for(i=0; i<document.forms[0].elements.length; i++)
    	{
    		if (document.forms[0].elements[i].type == 'checkbox')
    			document.forms[0].elements[i].checked = true;
    	}
    }
    
    
    //-->
    </SCRIPT>
    </HEAD>
    
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF" BACKGROUND="?">
    <FORM NAME="MyForm" ID="MyForm">
    <INPUT TYPE="CHECKBOX" NAME="MyCheckBox" ID="MyCheckBox">Test
    <INPUT TYPE="CHECKBOX" NAME="MyCheckBox" ID="MyCheckBox">Test2
    </FORM>
    <a href="javascript:doIt();">doIt</a>
    </BODY>
    </HTML>

  3. #3
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks! i'll go try it out!

  4. #4
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I also have a script to select all check boxes beginning with a certain string at http://anarchos.xs.mw/formtricks.phtml
    ck :: bringing chris to the masses.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •