动态组合框 [英] dynamic combo boxes

查看:44
本文介绍了动态组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




当另一个内容改变时,可以更改组合框的内容。例如,如果我有一个名为

服装的组合框,包含衬衫,裤子和帽子,当用户选择另一个名为'size''的组合框时,将包含尺码相关

衬衫(即胸部/颈部尺寸)。裤子也会出现同样的问题,而且还会发生一些问题。当用户选择服装组合框中的选项时,可用的

选项会在大小组合框中动态更改。任何想法?


欢呼



is it possible to change the contents of a combo box when the contents
of another are changed. for example, if i had a combo box called
garments containing shirts, trousers and hats, when the user selects
shirts another combo box called ''size'' would contain sizes in relation
to shirts (ie. chest/neck size). the same would occur for trousers and
hats. when the user selects an option in the garment combo box, the
options available change dynamically in the size combo box. any ideas?

cheers

推荐答案

" mr_burns" <双****** @ yahoo.co.uk>写道:
"mr_burns" <bi******@yahoo.co.uk> wrote:
当另一个内容改变时,是否可以更改组合框的内容。
is it possible to change the contents of a combo box when the contents
of another are changed.




那里那里有很多图书馆。


矿井位于: http://www.mattkruse.com/javascript/dynamicoptionlist/


此外,我正在对版本2进行最后润色该脚本具有更多功能和更好的界面:

http://www.mattkruse.com/javascript/dynamicoptionlist2/

希望有所帮助!

-

Matt Kruse

Javascript工具箱: http://www.mattkruse.com/javascript/



There are lots of libraries out there which do this.

Mine is at: http://www.mattkruse.com/javascript/dynamicoptionlist/

Also, I''m putting the finishing touches on version 2 of the script which has
more features and a better interface:

http://www.mattkruse.com/javascript/dynamicoptionlist2/

Hope that helps!

--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/


mr_burns写道:
mr_burns wrote:
当另一个的内容更改时,是否可以更改组合框的内容。例如,如果我有一个名为
服装的组合框,其中包含衬衫,裤子和帽子,当用户选择衬衫时,另一个名为尺寸的组合框将包含相关的尺寸
衬衫(即胸部/颈部尺寸)。裤子和帽子也会出现同样的情况。当用户在服装组合框中选择一个选项时,可用的
选项会在大小组合框中动态更改。任何想法?
is it possible to change the contents of a combo box when the contents
of another are changed. for example, if i had a combo box called
garments containing shirts, trousers and hats, when the user selects
shirts another combo box called ''size'' would contain sizes in relation
to shirts (ie. chest/neck size). the same would occur for trousers and
hats. when the user selects an option in the garment combo box, the
options available change dynamically in the size combo box. any ideas?




大多数动态浏览器都有助于在SELECT元素中交换

选项,或者切换显示几个

替代第二个SELECT元素。但是这样做的一个大问题

如果用户使用的浏览器不支持javascript(或禁用了javascript),用户会得到什么?你正在卖衣服,然后赚取利润,想要卖掉尽可能多的衣服。

在潜在顾客和他们之间放置任何人为障碍

与你做生意的能力不会增加利润。并且

客户使用支持javascript的动态网页浏览器与他们的着装需求之间没有任何可想象的关系。 (并且它不是网站开发者在

企业所有者网站上建立这种关系的地方,至少不会没有产生后果,并且

事实上没有必要,先向业主清楚。)


大多数根据<中的选择交换下一个SELECT中的选项br />
first SELECT"脚本存储了

javascript结构(数组和/或对象)中各种选项的所有日期,因此生成的用户界面为无法访问javascript的访问者无法使用(您有刚丢失了一个

潜在客户)。一些设计将所有可能的选项放在

的SELECT元素的HTML中然后删除不需要的选项,它们可以在没有javascript的情况下使用
但是不是确实很容易使用。

最后一个样式创建了许多第二个SELECT元素,包含第一个中每个选项的

选项,然后分别隐藏

不需要的。这也可以在没有客户端

脚本的情况下使用,但同样不一定非常容易使用。


此类型的所有脚本都更多在客户端不支持脚本时,或者

浏览器缺少必需的功能时,它们在降价时会降低不满意度。另一方面,即使没有javascript,

将选项放入HTML中仍允许客户购买衣服




但完全在服务器端脚本上运行的向导式界面,

可能是可靠性和可用性的最佳组合。

顾客选择裤子并提交选择表格,并且

被带到一个页面,在页面上他们可以选择类型,颜色和

大小的内容。后端返回适合初始选择的选项。

编程和使用相对容易,除了HTML之外,客户端没有任何依赖于
的东西支持。每个潜在的

客户都可以与该网站开展业务。


Richard。



The majority of dynamic browsers will facilitate the swapping of the
options in a SELECT element, or the switching of the display of several
alternative second SELECT elements. But a big question when doing that
is what will the user be getting if they are using a browser that does
not support javascript (or has it disabled)? You are selling clothes,
and to make profits you want to sell as many clothes as possible.
Placing any artificial barrier between the potential customer and their
ability to do business with you is not going to increase profits. And
there is no conceivable relationship between the customer''s use of a
javascript capable dynamic web browser and their need to dress. (And it
is not the web developer''s place to impose that relationship on the
business owners site, at least not without making the consequences, and
the fact that it is not necessary, clear to the business owner first.)

Most "swap the options in the next SELECT based on the selection in the
first SELECT" scripts store all of the date for the various options in
javascript structures (arrays and/or objects) so the resulting UI for
the javascript incapable visitor is unusable (you have just lost a
potential customer). A few designs place all of the possible options in
the HTML for the SELECT element and then remove the unneeded ones, they
are usable in the absence of javascript but are not exactly easy to use.
A last style creates numerous second SELECT elements containing the
options for each selection in the first, separately, and then hides the
unneeded ones. That is also usable in the absence of client-side
scripting but, again, not necessarily that easy to use.

All scripts of this type are more or less unsatisfactory in the way in
which they degrade when scripting is not supported on the client, or the
browser lacks the required features. On the other hand, the ones that
put the options in the HTML still allow the customer to purchase clothes
even without javascript.

But a wizard style interface, running entirely on server-side scripts,
is probably the best combination of reliability and usability. The
customer selects "trousers" and submits that selection form, and is
taken to a page on which they can select things like type, colour and
size. The back end returns the options suited to the initial selections.
It is relatively easy to program and use and there is no dependence on
anything on the client-side beyond HTML support. Every potential
customer is in a position to do business with the site.

Richard.


mr_burns写道:
mr_burns wrote:
当另一个组件的内容发生变化时,是否可以更改组合框的内容。例如,如果我有一个名为
服装的组合框,其中包含衬衫,裤子和帽子,当用户选择衬衫时,另一个名为尺寸的组合框将包含相关的尺寸
衬衫(即胸部/颈部尺寸)。裤子和帽子也会出现同样的情况。当用户在服装组合框中选择一个选项时,可用的
选项会在大小组合框中动态更改。任何想法?
is it possible to change the contents of a combo box when the contents
of another are changed. for example, if i had a combo box called
garments containing shirts, trousers and hats, when the user selects
shirts another combo box called ''size'' would contain sizes in relation
to shirts (ie. chest/neck size). the same would occur for trousers and
hats. when the user selects an option in the garment combo box, the
options available change dynamically in the size combo box. any ideas?




大多数动态浏览器都有助于在SELECT元素中交换

选项,或者切换显示几个

替代第二个SELECT元素。但是这样做的一个大问题

如果用户使用的浏览器不支持javascript(或禁用了javascript),用户会得到什么?你正在卖衣服,然后赚取利润,想要卖掉尽可能多的衣服。

在潜在顾客和他们之间放置任何人为障碍

与你做生意的能力不会增加利润。并且

客户使用支持javascript的动态网页浏览器与他们的着装需求之间没有任何可想象的关系。 (并且它不是网站开发者在

企业所有者网站上建立这种关系的地方,至少不会没有产生后果,并且

事实上没有必要,先向业主清楚。)


大多数根据<中的选择交换下一个SELECT中的选项br />
first SELECT"脚本存储了

javascript结构(数组和/或对象)中各种选项的所有日期,因此生成的用户界面为无法访问javascript的访问者无法使用(您有刚丢失了一个

潜在客户)。一些设计将所有可能的选项放在

的SELECT元素的HTML中然后删除不需要的选项,它们可以在没有javascript的情况下使用
但是不是确实很容易使用。

最后一个样式创建了许多第二个SELECT元素,包含第一个中每个选项的

选项,然后分别隐藏

不需要的。这也可以在没有客户端

脚本的情况下使用,但同样不一定非常容易使用。


此类型的所有脚本都更多在客户端不支持脚本时,或者

浏览器缺少必需的功能时,它们在降价时会降低不满意度。另一方面,即使没有javascript,

将选项放入HTML中仍允许客户购买衣服




但完全在服务器端脚本上运行的向导式界面,

可能是可靠性和可用性的最佳组合。

顾客选择裤子并提交选择表格,并且

被带到一个页面,在页面上他们可以选择类型,颜色和

大小的内容。后端返回适合初始选择的选项。

编程和使用相对容易,除了HTML之外,客户端没有任何依赖于
的东西支持。每个潜在的

客户都可以与该网站开展业务。


Richard。



The majority of dynamic browsers will facilitate the swapping of the
options in a SELECT element, or the switching of the display of several
alternative second SELECT elements. But a big question when doing that
is what will the user be getting if they are using a browser that does
not support javascript (or has it disabled)? You are selling clothes,
and to make profits you want to sell as many clothes as possible.
Placing any artificial barrier between the potential customer and their
ability to do business with you is not going to increase profits. And
there is no conceivable relationship between the customer''s use of a
javascript capable dynamic web browser and their need to dress. (And it
is not the web developer''s place to impose that relationship on the
business owners site, at least not without making the consequences, and
the fact that it is not necessary, clear to the business owner first.)

Most "swap the options in the next SELECT based on the selection in the
first SELECT" scripts store all of the date for the various options in
javascript structures (arrays and/or objects) so the resulting UI for
the javascript incapable visitor is unusable (you have just lost a
potential customer). A few designs place all of the possible options in
the HTML for the SELECT element and then remove the unneeded ones, they
are usable in the absence of javascript but are not exactly easy to use.
A last style creates numerous second SELECT elements containing the
options for each selection in the first, separately, and then hides the
unneeded ones. That is also usable in the absence of client-side
scripting but, again, not necessarily that easy to use.

All scripts of this type are more or less unsatisfactory in the way in
which they degrade when scripting is not supported on the client, or the
browser lacks the required features. On the other hand, the ones that
put the options in the HTML still allow the customer to purchase clothes
even without javascript.

But a wizard style interface, running entirely on server-side scripts,
is probably the best combination of reliability and usability. The
customer selects "trousers" and submits that selection form, and is
taken to a page on which they can select things like type, colour and
size. The back end returns the options suited to the initial selections.
It is relatively easy to program and use and there is no dependence on
anything on the client-side beyond HTML support. Every potential
customer is in a position to do business with the site.

Richard.


这篇关于动态组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆