Show/Hide function using checkbox

Discussion in 'JavaScript' started by Leigh79, May 25, 2007.

  1. #1
    Hi Guys

    Could someone give me a hand?

    I've got an asp form which will allow users to update their profile. At the bottom of the form there is a checkbox which depending on it's status will display some additional information for the user to fill out.

    The checkbox's initial value will be generated from their user record from the database. From here I then want to be able to hide/show the additional fields depending on both the checkbox checked status and the db variable. This would give 6 different combinations:

    db variable = 1, checkbox = NULL, additional fields = show
    db variable = 0, checkbox = NULL, additional fields = hide
    db variable = 1, checkbox = 1, additional fields = show
    db variable = 0, checkbox = 0, additional fields = hide
    db variable = 1, checkbox = 0, additional fields = hide
    db variable = 0, checkbox = 1, additional fields = show

    Any ideas on how to write this as a function?

    Thanks in advance
    Leigh
     
    Leigh79, May 25, 2007 IP