check box enable/disable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vncntj@hotmail.com

    check box enable/disable

    i want to enable one listbox and disable the other depending on if i
    check winter_gala (checkbox)

    here is my code.
    <script type="text/javascript">
    function check()
    {
    if (document.forms .winter_gala.ch ecked=true)
    {
    document.forms. winter_gala.you ng_friend_list. disabled=true
    document.forms. winter_gala.dua l_young_friend_ list.disabled=f alse
    }
    else if (document.forms .winter_gala.ch ecked=false)
    {
    document.forms. winter_gala.you ng_friend_list. disabled=false
    document.forms. winter_gala.dua l_young_friend_ list.disabled=t rue
    }
    }
    </script>

  • Richard Cornford

    #2
    Re: check box enable/disable

    vncntj@hotmail. com wrote:[color=blue]
    > i want to enable one listbox and disable the other depending on if i
    > check winter_gala (checkbox)
    >
    > here is my code.
    > <script type="text/javascript">
    > function check()
    > {
    > if (document.forms .winter_gala.ch ecked=true)[/color]
    <snip> ^

    That is an assignment, not comparison (except in JavaScript 1.2).
    Comparison is - == - (type-converting) or - === -(identity,
    non-type-converting), but it is never necessary to compare a boolean
    value with a boolean literal to get a boolean result that is equivalent
    to the trueness of the value.

    Forms, those objects that can be retrieved as named properties of the -
    document.forms - collection, do not have a - checked - property, so you
    probably should be referring to an <input type="checkbox" > element (by
    name/ID) at that point. As you have not included the HTML that this
    script is attempting to interact with it is not possible to suggest the
    correct property accessor for use in your context.

    Richard.


    Comment

    Working...