案例陈述执行步骤(Case statement execution steps)
我有以下案例陈述:
A = 1 case A is when 1 => A = 2; => Run; when 3 .. 15 => null; when 16 | 17 => Jump; when 2 | 18..35 => Swing; when others => Nothing; end case;
所以case语句将转到1,因为A初始化为1.然后A将等于2,然后代码将执行Run。 此时代码是否退出case语句,还是会执行Swing,因为A被更改为2的值?
I have the following case statement:
A = 1 case A is when 1 => A = 2; => Run; when 3 .. 15 => null; when 16 | 17 => Jump; when 2 | 18..35 => Swing; when others => Nothing; end case;
So the case statement will go to 1 since A is initialized to 1. A will then be equal to 2, and then the code will execute Run. Does the code exit out of the case statement at this point, or will Swing be executed because A was changed to a value of 2?
原文:https://stackoverflow.com/questions/29957285
更新时间:2023-09-07 21:09
最满意答案
这是我找到的解决方案。
/* Using the Below inside onChange event handler var obj = $(this); obj[0].setValue(""); */ onChange: function (value) { var obj = $(this); if (($.inArray(value, selectedList) > -1)) { alert("Lot " + value + " has already been selected. Please recheck your selection and try again"); obj[0].setValue(""); } else { } },
This is the solution I found.
/* Using the Below inside onChange event handler var obj = $(this); obj[0].setValue(""); */ onChange: function (value) { var obj = $(this); if (($.inArray(value, selectedList) > -1)) { alert("Lot " + value + " has already been selected. Please recheck your selection and try again"); obj[0].setValue(""); } else { } },
相关问答
更多-
当用户在文本框输入字符,会触发文本框的什么事件[2023-03-21]
onchange -
jsFiddle演示 ( http://jsfiddle.net/json/Lh3anheq/35/ ) 好的,根据我们在上面评论中的讨论,您希望selectize.js返回所选项目的id ,并且还允许用户创建唯一项目。 您对id是正确的:您只需要将valueField: 'text'替换为valueField: 'id' 。 现在我们需要在你的函数hasOwnPropertyCaseInsensitive修复决策。 此函数中的第一个参数是对象的对象。 如果您看到控制台输出,对于您的selectize元素的 ...
-
您可以使用.on('change', handler)事件 : // When you create your selectize var $select = $("#select_id").selectize({ // Options here }); var selectizeControl = $select[0].selectize; 然后你可以访问它 selectizeControl.on('change', function() { var value = selectize. ...
-
喜欢这个? http://jsfiddle.net/2zyp8jxn/1/ control.setValue("4"); 用php创建一个变量: $php_test = "control.addOption({ id: '".$dataFromDB['type']."', hari: '".$dataFromDB['type']."' }); control.s ...
-
Primefaces selectOneButton:onchange - 获取选定的值(Primefaces selectOneButton: onchange - get selected value)[2023-10-28]
不要将this.value传递给onChangeGender ,而是尝试传递event.target.value 。 Instead of passing this.value to onChangeGender, try passing event.target.value. -
在使用开发人员工具进行一些挖掘之后,事实证明您可以从事件处理程序中获取底层输入元素: this.$input 其中$input是底层元素的jQuery对象。 不幸的是,这不在文档中。 用法: $('.lookup').selectize({ onChange: function(value) { var data = this.$input.data('stuff'); } }); After some more digging using developer tool ...
-
selectize.js:清除onChange事件中的选定值(selectize.js : to clear selected value in onChange event)[2022-07-24]
这是我找到的解决方案。 /* Using the Below inside onChange event handler var obj = $(this); obj[0].setValue(""); */ onChange: function (value) { var obj = $(this); if (($.inArray(value, selectedList) > -1)) { alert("Lot " + value + " has a ... -
应使用addOption()函数添加选项,而不是直接使用HTML操作注入。 添加选项后,必须调用refreshOptions()函数来更新UI。 您也可以使用options配置选项代替addOption() ,该options期望将值数组注入
-
我修改了你的代码,这就是我做到的 工作小提琴 : Javascript: $( "#svalue" ).change(function() { if (confirm('...?')) { vals =$('#svalue').val(); $('#svalue').val(this.options[this.selectedIndex].value); }else{ $('#svalue').val(vals); } }); HTML ...
-
当onchange被触发时,您可以直接获得country价值 $('#selectedPlace').on('change', function (e) { var optionSelected = $("option:selected", this); var place = this.value; console.log( $('#selectCountry').val()); console.log(place); }); You can directly get ...