简体   繁体   English

Dynamics CRM 2011传递数组作为参数

[英]Dynamics CRM 2011 Pass Array as Parameter

I have tried setting the parameter as: 我尝试将参数设置为:

array("item1","item2","item3")

and also as: 并作为:

new array("item1","item2","item3")

and also as: 并作为:

var Labels = new array("item1","item2","item3")

在此处输入图片说明

but I can't seem to pass an array to the following function: 但我似乎无法将数组传递给以下函数:

function BoldLabel(Labels) {
  var length = Labels.length;
  var element = null;
  for (var i = 0; i < length; i++) {
    element = Labels[i];
    document.getElementById(element).style.fontWeight="bolder";
    document.getElementById(element).style.fontSize="13px";
  }
}

I keep getting an "array is undefined" error. 我不断收到“数组未定义”错误。 I thought for sure I saw this done somewhere but can't find the example anymore. 我想当然可以在某个地方看到它,但是现在找不到该示例了。 The problem is that I'd like to be able to reuse this code and so just passing an array of the items I want to bold would be easier than cutting and pasting the code to a new function and writing in each label name individually like 问题是我希望能够重用此代码,因此仅传递要加粗的项目数组会比将代码剪切并粘贴到新函数并像这样分别写入每个标签名称更容易

document.getElementById("new_pricingsubtotal_c").style.fontWeight="bolder";
document.getElementById("new_pricingsubtotal_c").style.fontSize="13px";
document.getElementById("new_pricingsubtotal1_c").style.fontWeight="bolder";
document.getElementById("new_pricingsubtotal1_c").style.fontSize="13px";
document.getElementById("new_lineitemtotal_c").style.fontWeight="bolder";
document.getElementById("new_lineitemtotal_c").style.fontSize="13px";
document.getElementById("new_trucktotalcost_c").style.fontWeight="bolder";
document.getElementById("new_trucktotalcost_c").style.fontSize="13px";

Any help with this would be greatly appreciated!! 任何帮助,将不胜感激!

Did you try Array (as opposed to array )? 您是否尝试过Array (而不是array )? Also, you might try it using an array literal, eg: var myarray=["item1", "item2", "item3"] 另外,您可以使用数组文字来尝试它,例如: var myarray=["item1", "item2", "item3"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM