我不知道如何在查询后将条件应用于结果。之前有人问过这段代码,但我想增强它
require(["dojo/parser", "dojo/ready", "dojo/query", "dojo/on", "dijit/form/Select", "dojo/domReady!"], function (parser, ready, query, on, Select) {
ready(function () {
parser.parse();
var select_Card = new Select({
name: 'select_PCBA',
options: [{
label: "<span id='NotinUse'><b>   . . .</b></span>",
value: "",
selected: true
}, {
label: "<span id='NotinUse'><b>  Mk7ABC Card</b></span>",
value: "testdata1970_05"
}, {
label: "<span id='inUse'><b>  Mk7CBC Card</b></span>",
value: "testdata1970_10"
}, {
label: "<span id='NotinUse'><b>  Mk10DC Card</b></span>",
value: "testdata2060_03"
}, {
label: "<span id='NotinUse'><b>  Mk6BC Card</b></span>",
value: "dbProdigy"
}, {
label: "<span id='NotinUse'><b>  Mk6NBC Card</b></span>",
value: "dbProdigy_MK6N"
}, ],
style: {
width: '150px'
}
}, "select_Card");
select_Card.startup();
on(select_Card, 'change', function(newValue)
{
if query('#inUse')
{
alert('Item selected is '+ newValue);
}
else
{
alert('Please select the only highlighted card');
}
});
});
});
或者为了您的方便,请参阅我的 jsfiddle。
还是你有更好的办法?
请指教 谢谢
克莱门特