如何为CheckedMultiSelect的每个元素添加不同的标题?

时间:2012-07-12 14:07:19

标签: javascript html checkbox dojo

我正在尝试为CheckedMultiSelect中的每个复选框添加标题。

创建CheckedMultiSelect的代码:

<select id="123" class="soria" dojoType="dojox.form.CheckedMultiSelect" 
        multiple="true" style="width:267px; height:260px;" onchange=""
        store="listStore">
</select>

listStore是来自json的dojo.data.ItemFileReadStore

如何将标题添加到复选框?

UPD。最后我收到了这样的HTML代码(多重选择的单个元素的源代码):

<div aria-selected="false" widgetid="dojox_form__CheckedMultiSelectItem_4"
     id="dojox_form__CheckedMultiSelectItem_4" 
     class="dijitReset dojoxMultiSelectItem">

      <div widgetid="dijit_form_CheckBox_4" role="presentation" 
            class="dijitReset dijitInline dojoxMultiSelectItemBox dijitCheckBox" 
            wairole="presentation">

        <input aria-pressed="false" style="-moz-user-select: none;" 
        tabindex="0" id="dijit_form_CheckBox_4" value="on" 
        class="dijitReset dijitCheckBoxInput" dojoattachpoint="focusNode"
        dojoattachevent="onmouseover:_onMouse,onmouseout:
                         _onMouse,onclick:_onClick" 
        type="checkbox">

      </div>

      <div class="dijitInline dojoxMultiSelectItemLabel" 
            dojoattachpoint="labelNode" dojoattachevent="onmousedown:_onMouse,
                    onmouseover:_onMouse,onmouseout:_onMouse, onclick:_onClick">
            MICHAEL, DOPHINE
      </div>
</div>

问题:如何指出dojo为此元素设置唯一标题?

1 个答案:

答案 0 :(得分:0)

您可以添加一个随后更改标题的脚本,如

<script>
var o = document.getElementsByTagName('input');

for(var x in o){
   // check if o[x].name is one of these and then
   // do something with o[x].title ...
}
</script>