我有可以在JSFiddle中使用的JavaScript,但不能在LiveCycle Designer ES3中使用。我想做的是,当选择了默认选项以外的其他选项(更改时)时,下拉列表字段会更改背景颜色。

function BackgroundChange(ddl) {

var value = ddl.srcElement.options[ddl.srcElement.selectedIndex].value;
var positionddlist = document.getElementById('positionddlist');

// 99 is the value assigned to the default option
if (value !== "99") {
alert('Changes from default values require comment.');
document.getElementById('positionddlist').style.backgroundColor = "orange";

} else {
document.getElementById('positionddlist').style.backgroundColor = "";
}
}


有什么建议吗?

最佳答案

恐怕我有个坏消息要告诉你。 LiveCycle Designer中提供给您的DOM代码不是HTML DOM,因此它不支持相同的方法和属性。在这种情况下,没有srcElement属性,也没有getElementById方法。

[LiveCycle Designer Scripting Reference][1]中概述了可用的属性和方法的列表。

设置边框颜色的最简单方法是传入对象,然后使用fillColor设置值,如下所示:

DropDownList1.fillColor = "255,102,0";


就个人而言,我非常依赖LiveCycle Designer的对象辅助来引导我了解对象的属性。

关于javascript - Javascript在Livecycle中不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35320362/

10-12 15:18