我想知道是否可以将变量的名称设为动态:
而不是这段代码:
function GetCategoryAttributeList() {
$.ajax({
async: true,
type: "POST",
url: "[myurl]/PopulateHOT",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
//handle returned data from service
var hotElement = $('#example');
if(hotElement){
var hot = new Handsontable(hotElement, { data: data });
}
}
});
我想要这样的事情:
[images1 addObject:nameBild];
[images2 addObject:nameBild];
[images3 addObject:nameBild];
[images4 addObject:nameBild];
images1.alpha = 0.5;
images2.alpha = 0.5;
images3.alpha = 0.5;
images4.alpha = 0.5;
或者这样:
for (int i=1; i<5; i++) {
[images(i) addObject:nameBild];
images(i).alpha = 0.5;
}
有人能以这种方式支持我吗?我会很感激你的回答。提前谢谢。
问候