首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dojo和/或javascript:多选择中滚动条的onclick事件

问Dojo和/或javascript:多选择中滚动条的onclick事件
EN

Stack Overflow用户
提问于 2013-09-16 19:45:45
回答 1查看 805关注 0票数 0

我在一个页面上有一个多重选择,并且我已经设置它,以便当单击其中一个选项时,该页面上的另一个选择被禁用。我遇到的问题是客户机希望禁用另一个select,即使用户只是单击multiselect的滚动条。我在select标签上有onclick事件。如果用户单击multiselect的滚动条,是否会触发脚本?

代码语言:javascript
复制
<select name="disable_this" id="disable_this" data-dojo-type="dijit.form.FilteringSelect" data-dojo-props="maxHeight:300" style="width:500px; overflow:hidden;" onclick="javascript:disableOtherSelect('thisone_multiple','disable_this');">
                    <option selected="selected">Select</option>
                    <option>first</option>
                    <option>second</option>
                    <option>third</option>
                </select>



<select name="thisone_multiple" id="thisone_multiple" data-dojo-type="dijit.form.MultiSelect" multiple="multiple" data-dojo-props="maxHeight:300" style="width:500px; overflow:hidden;" onclick="javascript:disableOtherSelect('disable_this','thisone_multiple');">
                <option selected="selected">Select</option>
                    <option>C - Example Account Name 1</option>
                    <option>A - Example Account Name 2</option>
                    <option>B - Example Account Name 3</option>
                    <option>ZZ - Example Account Name 4</option>
                    <option>AA - Example Account Name 5</option>
                </select>


function disableOtherSelect(layer,layer2){
        //disable the other one based on arguments from the onchange event
      dijit.byId(layer2).set('disabled', false);
      dijit.byId(layer).set('disabled', true);


    };

更新

我创建了一个简单的jsfiddle,它显示了对select和multiselect的单击。如您所见,单击multiselect上的滚动条不会触发脚本,但单击select上的箭头会触发脚本:

http://jsfiddle.net/txujL/2/

EN

回答 1

Stack Overflow用户

发布于 2013-09-18 18:06:51

我找到了一个更好的方法。我没有禁用表单输入,而是设置它们,以便在单击另一个半透明div时,有效地阻止用户在“禁用”div中进行选择。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18836066

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档