我想知道我是否可以在JavaScript中使用for()循环来构建我的函数中使用的动态ColdFusion变量。以下是我的例子:
listTypes = ['a','b'];
for(var i=0; i < listTypes.length; i++){
getBldgs('#trim(getRec.st_'+listTypes[i]+'Bldg)#', '#trim(getRec.st_'+listTypes[i]+'Bldg)#', listTypes[i]+'Bldg');
}
在此过程中应该做的就是替换索引并多次调用函数getBldgs()。我收到了这个错误:
ColdFusion was looking at the following text:
/'
The CFML compiler was processing:
An expression beginning with trim, on line 327, column 32.This message is usually caused by a problem in the expressions structure.
The body of a cfoutput tag beginning on line 85, column 2.
如果有人可以提供帮助,请告诉我。