469,311 Members | 2,501 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,311 developers. It's quick & easy.

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
Jul 23 '05 #1
3 2437
Tony Kim wrote:
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.


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
Jul 23 '05 #2
Tony Kim wrote:
i have an assignment that needs immediate attention and was hoping i
would be able to get some help here.


Example:
http://examples.tobyinkster.co.uk/ch...ff/choosestuff

Pretty Highlighted Source Code:
http://examples.tobyinkster.co.uk/ch...hoosestuff-src

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

Jul 23 '05 #3
Tony Kim wrote:

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.

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
http://blog.outer-court.com
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by SC | last post: by
reply views Thread by Pakmanoncrack | last post: by
1 post views Thread by sauravb | last post: by
reply views Thread by j4v3d | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.