我有一个选择框调用'ToLB',它从另一个选择框中获取值项目。我需要从'ToLB'中提取这些选定的值并将其打印在标签上,这就是我的工作方式,但显然它没有工作,因为没有错误信息,但没有打印到标签上,请提出建议,谢谢! :
选择框:
<select multiple size="8" name="ToLB" style="width: 135px" onblur="javascript:dropValue6(this)">
</select>
标签:
QMType: <asp:Label ID="destinationQualMemType" runat="server" ></asp:Label >
Javascript功能:
function dropValue6(source) {
while (source.selectedIndex != -1)
{
if (source.selectedIndex != 0) arSelected.push(source.options[source.selectedIndex].value);
source.options[source.selectedIndex].selected = false;
var i;
for (i = 0; i < arSelected; i++) {
document.getElementById('<%= destinationSpendingType.ClientID %>').innerHTML =
+ "\n" + document.getElementById('<%= destinationSpendingType.ClientID %>').innerHTML = arSelected[i].value;
}
}
}
答案 0 :(得分:2)
您可能会看到标有//***
function dropValue6(source) {
var arSelected = []; // ***
while (source.selectedIndex != -1)
{
if (source.selectedIndex != 0) arSelected.push(source.options[source.selectedIndex].value);
source.options[source.selectedIndex].selected = false;
var i;
for (i = 0; i < arSelected.length; i++) { // ***
document.getElementById('<%= destinationSpendingType.ClientID %>').innerHTML = arSelected[i]; // ***
}
}
}