How to use the Options tag in HTML (help needed asap!)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Kim

    How to use the Options tag in HTML (help needed asap!)

    Hi everyone,

    i have an assignment that needs immediate attention and was hoping i
    would be able to get some help here.

    im trying to create 3 option boxes that are linked together.

    for example:

    <Option Box 1> <Option Box 2> <Option Box 3>

    General Information -----> Info 1.1 ---------> Next Info 1.1.1
    -----> Info 1.2 ---------> Next Info 1.2.1

    Contact Information -----> Info 2.1 ---------> Next Info 2.1.1
    -----> Info 2.2 ---------> Next Info 2.2.1

    from my limited HTML knowledge, i can only manage to link two of them
    together using the simple code:

    <select>
    <option value="Info 1.1">General Information
    <option value="Info 1.2">General Information
    <option value="Info 2.1">Contact Information
    <option value="Info 2.2">Contact Information
    </select>

    Please advise =_=
    tony
  • David Dorward

    #2
    Re: How to use the Options tag in HTML (help needed asap!)

    Tony Kim wrote:
    [color=blue]
    > i have an assignment that needs immediate attention and was hoping i
    > would be able to get some help here.
    >
    > im trying to create 3 option boxes that are linked together.[/color]

    Does your keyboard not have a shift key?

    It seems you are asking for the option selected in one select element to
    determine the options available to select in a second, and for the option
    selected there to determine the options available in a third.

    This is not possible in HTML. Select elements cannot be made interdependant.
    You could make use of the optgroup element to group a number of options
    together - but this only lets you go one level deep. (Future versions of
    HTML (Ha!) may, according to the 4.01 specification allow nested optgroups,
    but that is something for the distant future.

    This leaves scripting. The safe way would be to have the user submit the
    form, then display a different selection of options, and repeat as desired.
    The unsafe way would be to use JavaScript to dynamically repopulate the
    subsequent select elements when the onchange event of previous select
    elements is triggered. You could combine the two methods so that the user
    can submit the form to see new options if the JavaScript fails to work. If
    you use JavaScript, you should probably consider defaulting subsequent
    select elements to "DISABLED" (and remembering to reset 3 if 2 changes and
    bother 2 and 3 if 1 changes).

    --
    David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is

    Comment

    • Toby Inkster

      #3
      Re: How to use the Options tag in HTML (help needed asap!)

      Tony Kim wrote:
      [color=blue]
      > i have an assignment that needs immediate attention and was hoping i
      > would be able to get some help here.[/color]

      Example:


      Pretty Highlighted Source Code:


      --
      Toby A Inkster BSc (Hons) ARCS
      Contact Me ~ http://tobyinkster.co.uk/contact

      Comment

      • Philipp Lenssen

        #4
        Re: How to use the Options tag in HTML (help needed asap!)

        Tony Kim wrote:
        [color=blue]
        >
        > i have an assignment that needs immediate attention and was hoping i
        > would be able to get some help here.
        >
        > im trying to create 3 option boxes that are linked together.
        >[/color]


        Try "optgroup". It may help here. You can't style it much in Win-IE6
        (you can in Firefox and others), but its default styling isn't too bad
        either.

        --
        Google Blogoscoped
        A daily news blog and community covering Google, search, and technology.

        Comment

        Working...