By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,203 Members | 1,546 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,203 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.