show/hide divs on checkbox click

Discussion in 'ASP General' started by Mike P, Nov 14, 2007.

  1. Mike P

    Mike P Guest

    I am trying to hide/show divs based upon whether or not a checkbox is
    clicked. Here is what I have done so far to check if the method is
    being called correctly, but I am getting the javascript error 'object
    required' :

    function HideShowContactDetails()
    {
    if (document.Form2.ContactType.value == "true")
    {
    alert ("Contact Type selected");
    return false;
    }
    else
    {
    alert("Contact Type unselected");
    return false;
    }
    }

    <form action=processAddCompanyAndContact.asp?process=amend method=post
    onSubmit="return Validate2()" name="Form2">

    <input type="checkbox" name="ContactType"
    onClick="HideShowContactDetails()" />





    *** Sent via Developersdex http://www.developersdex.com ***
    Mike P, Nov 14, 2007
    #1
    1. Advertising

  2. Mike P

    Dooza Guest

    Mike P wrote:
    > I am trying to hide/show divs based upon whether or not a checkbox is
    > clicked. Here is what I have done so far to check if the method is
    > being called correctly, but I am getting the javascript error 'object
    > required' :
    >
    > function HideShowContactDetails()
    > {
    > if (document.Form2.ContactType.value == "true")
    > {
    > alert ("Contact Type selected");
    > return false;
    > }
    > else
    > {
    > alert("Contact Type unselected");
    > return false;
    > }
    > }
    >
    > <form action=processAddCompanyAndContact.asp?process=amend method=post
    > onSubmit="return Validate2()" name="Form2">
    >
    > <input type="checkbox" name="ContactType"
    > onClick="HideShowContactDetails()" />


    Don't you need to give the input a default value?
    Dooza, Nov 14, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. middletree
    Replies:
    0
    Views:
    582
    middletree
    Oct 25, 2005
  2. Mike P
    Replies:
    7
    Views:
    906
  3. Frances
    Replies:
    3
    Views:
    101
    Randy Webb
    Sep 9, 2005
  4. Replies:
    2
    Views:
    425
  5. ll
    Replies:
    2
    Views:
    633
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page