try:function selectChange(control, controlToPopulate, ItemArray, GroupArray)
{
var myEle ;
var x ;
// Empty the second drop down box of any choices
for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
// ADD Default Choice - in case there are no values
myEle = document.createElement("option") ;
myEle.value = "" ;
myEle.text = "[选 择]" ;
controlToPopulate.add(myEle) ;
bool bAdd = false;
for ( x = 0 ; x < ItemArray.length ; x++ )
{
if ( GroupArray[x] == control.value )
{
bAdd = true;
myEle = document.createElement("option") ;
myEle.value =x ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}if( !bAdd )
{
myEle.text = "无";
}
}
{
var myEle ;
var x ;
// Empty the second drop down box of any choices
for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
// ADD Default Choice - in case there are no values
myEle = document.createElement("option") ;
myEle.value = "" ;
myEle.text = "[选 择]" ;
controlToPopulate.add(myEle) ;
bool bAdd = false;
for ( x = 0 ; x < ItemArray.length ; x++ )
{
if ( GroupArray[x] == control.value )
{
bAdd = true;
myEle = document.createElement("option") ;
myEle.value =x ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}if( !bAdd )
{
myEle.text = "无";
}
}
解决方案 »
- 链接(A标签)的onclick事件触发表单提交操作后不跳转页面的有关问题
- 遍历js对象属性求解
- 请问一个JS中层的问题?
- 后台数据传递到前台的问题,主要是写法的问题
- js读取xml问题
- 求问js动态添加下拉框
- 请帮忙看一小段代码在 Google Chrome 里不工作
- jquery怎么得到表格第一行以外的行
- 请问高手这几行代码是什么意思!
- 请大家帮忙,在线等:如何让表格中的控件长度随列宽的改变而改变?
- 隐藏一个DIV(notCheck.style.display="none";)这个语法在IE中好用,不知在firefox浏览器中如何来写?
- 问个难点的,鼠标移过网页中的某个静态元素时,如何得到它的坐标?
{
var myEle ;
var x ;
// Empty the second drop down box of any choices
for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
// ADD Default Choice - in case there are no values
myEle = document.createElement("option") ;
myEle.value = "" ;
myEle.text = "[选 择]" ;
var saveEle = myEle;
controlToPopulate.add(myEle) ;
bool bAdd = false;
for ( x = 0 ; x < ItemArray.length ; x++ )
{
if ( GroupArray[x] == control.value )
{
bAdd = true;
myEle = document.createElement("option") ;
myEle.value =x ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}if( !bAdd )
{
saveEle.text = "无";
}
}
这次应该没问题,刚刚是我太不小心了,没仔细看。