function aa() {
var list3 = document.getElementById("<%# ListBox3.ClientID %>");
var list4 = document.getElementById("<%# ListBox4.ClientID %>");
var frag = document.createDocumentFragment();
for(var i =0;i<list3.length;i++)
{
var oOption = document.createElement("option");
oOption.setAttribute("value",list3[i].value);
oOption.innerHTML=list3[i].value;
frag.appendChild(oOption);
}
list4.appendChild(frag);
list3.length=0;
}
为什么缺少对象 function aa() {
var list3 = document.getElementById("<%= ListBox3.ClientID %>");
var list4 = document.getElementById("<%= ListBox4.ClientID %>");
var frag = document.createDocumentFragment();
for(var i =0;i<list3.length;i++)
{
var oOption = document.createElement("option");
oOption.setAttribute("value",list3[i].value);
oOption.innerHTML=list3[i].value;
frag.appendChild(oOption);
}
list4.appendChild(frag);
list3.length=0;
}
在别的程序上能用 我的就不能用 有错误 要是吧<%=%>改成<%#%>我的就能用了
但是 提示我错误 缺少对象 for(var i =0;i<list3.length;i++)
这句
var list3 = document.getElementById("<%# ListBox3.ClientID %>");
var list4 = document.getElementById("<%# ListBox4.ClientID %>");
var frag = document.createDocumentFragment();
for(var i =0;i<list3.length;i++)
{
var oOption = document.createElement("option");
oOption.setAttribute("value",list3[i].value);
oOption.innerHTML=list3[i].value;
frag.appendChild(oOption);
}
list4.appendChild(frag);
list3.length=0;
}
为什么缺少对象 function aa() {
var list3 = document.getElementById("<%= ListBox3.ClientID %>");
var list4 = document.getElementById("<%= ListBox4.ClientID %>");
var frag = document.createDocumentFragment();
for(var i =0;i<list3.length;i++)
{
var oOption = document.createElement("option");
oOption.setAttribute("value",list3[i].value);
oOption.innerHTML=list3[i].value;
frag.appendChild(oOption);
}
list4.appendChild(frag);
list3.length=0;
}
在别的程序上能用 我的就不能用 有错误 要是吧<%=%>改成<%#%>我的就能用了
但是 提示我错误 缺少对象 for(var i =0;i<list3.length;i++)
这句
var list3 = document.getElementById("<%# ListBox3.ClientID %>");
有问题
就出现The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
错误
那怎么解决????、
没有获取到值。ListBox3.ClientID 看是否有这个元素
指定是要用<%=%>
2. 错误信息很明确地说了, 有了这个东西后, 就不能再修改控件集. 你的代码里修改了控件集, 才报的错. 并不是因为<%= 报错.