Show Hide Question

Discussion in 'Javascript' started by Mel, Jul 11, 2006.

  1. Mel

    Mel Guest

    i Have a table with two columns and a checkbox above it.
    when the box is checked, i like to show the two <TD>s

    i have:

    <TD ID=1000 style=display=none>APPLE</TD>
    <TD ID=1000 style=display=none>ORANGE</TD>

    how can i do this with JS ?

    i have used getElementById, but it only return one of the ids '1000'

    thanks
     
    Mel, Jul 11, 2006
    #1
    1. Advertising

  2. Mel

    Ian Collins Guest

    Mel wrote:
    > i Have a table with two columns and a checkbox above it.
    > when the box is checked, i like to show the two <TD>s
    >
    > i have:
    >
    > <TD ID=1000 style=display=none>APPLE</TD>
    > <TD ID=1000 style=display=none>ORANGE</TD>
    >

    This is invalid markup, id must be unique.

    Use CSS classes, one for hidden and one for visible.

    --
    Ian Collins.
     
    Ian Collins, Jul 11, 2006
    #2
    1. Advertising

  3. Mel wrote:

    > i Have a table with two columns and a checkbox above it.
    > when the box is checked, i like to show the two <TD>s
    >
    > i have:
    >
    > <TD ID=1000 style=display=none>APPLE</TD>
    > <TD ID=1000 style=display=none>ORANGE</TD>


    This is very wrong. An id is a unique (per document) identifier, you can't
    have two elements in the same document with the same id. Additionally, an
    id cannot begin with a number.

    Attribute values containing "=" characters must be quoted, and CSS uses
    a ":" to assign a value to a property, not an "=".

    > how can i do this with JS ?
    >
    > i have used getElementById, but it only return one of the ids '1000'


    Use something else to identify the elements. There are a number of
    implementations of getElementByClassName on the WWW.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Jul 11, 2006
    #3
    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. Jerad Rose

    Dynamically Show/Hide Groups of TR's

    Jerad Rose, Jun 24, 2003, in forum: ASP .Net
    Replies:
    12
    Views:
    11,654
    intrader
    Jul 10, 2005
  2. =?Utf-8?B?bWlrZWU=?=

    Cursor wait, hide or show

    =?Utf-8?B?bWlrZWU=?=, Dec 12, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    751
    Alex Papadimoulis
    Dec 12, 2003
  3. Patrick Olurotimi Ige

    Show / Hide Navigation Question

    Patrick Olurotimi Ige, Mar 24, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    415
    Sharon
    Mar 24, 2005
  4. Replies:
    3
    Views:
    109
    Randy Webb
    Feb 15, 2007
  5. ll
    Replies:
    2
    Views:
    685
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page