我的程序中要实现省市联动,可是为什么总是出现stack overflow at line:xxx?
我的代码如下:我觉得好像是removeAllList(noRemoveValue)函数的问题,可是不知道怎么改啊!求大家帮忙看一下什么毛病哈!先谢谢啦!
<script>
function removeAllList(noRemoveValue)
{
var objObject = unitInfoForm.citycode;
var objLen = objObject.length;
for (var i=0;i<objLen;i++)
{
if ( objObject.options[i].value != noRemoveValue)
{
objObject.options.remove(i);
removeAllList(noRemoveValue);
break;
}
}
}
function removeAllListSource(noRemoveValue)
{
var objSource = document.unitInfoForm.citycode;
if(objSource.length!=undefined && objSource.length>=0)
{
var objLen = objSource.length;
for (var i=0;i<objLen;i++)
{
if(objSource.options[i].value != noRemoveValue)
{
objSource.options.remove(i);
removeAllListSource(noRemoveValue);
break;
}
}
}
}
function addtolist(obj,value,label)
{
obj.add(new Option(value,label));
}
function change()
{
var objSource =document.unitInfoForm.citycode;
removeAllListSource();
userarray = new Array();
userarray1= new Array();
deparray = new Array();
<%
for(int j=0;j<list2.size();j++)
{
out.println("userarray["+j+"]='"+((Citycode)list2.get(j)).getCityname()+"';");
out.println("userarray1["+j+"]='"+((Citycode)list2.get(j)).getCitycode()+"';");
out.println("deparray["+j+"]='"+((Citycode)list2.get(j)).getFlagpro()+"';");
}
%> for(var i=0;i<userarray.length;i++)
{
if (deparray[i]==document.unitInfoForm.provincecode.value || document.unitInfoForm.provincecode.value=="1000")
{
addtolist(objSource,userarray[i],userarray1[i]);
}
}
}
</script><html:select property="provincecode" style="width:90px;" value="北京" onchange="change()">
<html:select property="citycode" style="width:120px;" value="北京" >
我的代码如下:我觉得好像是removeAllList(noRemoveValue)函数的问题,可是不知道怎么改啊!求大家帮忙看一下什么毛病哈!先谢谢啦!
<script>
function removeAllList(noRemoveValue)
{
var objObject = unitInfoForm.citycode;
var objLen = objObject.length;
for (var i=0;i<objLen;i++)
{
if ( objObject.options[i].value != noRemoveValue)
{
objObject.options.remove(i);
removeAllList(noRemoveValue);
break;
}
}
}
function removeAllListSource(noRemoveValue)
{
var objSource = document.unitInfoForm.citycode;
if(objSource.length!=undefined && objSource.length>=0)
{
var objLen = objSource.length;
for (var i=0;i<objLen;i++)
{
if(objSource.options[i].value != noRemoveValue)
{
objSource.options.remove(i);
removeAllListSource(noRemoveValue);
break;
}
}
}
}
function addtolist(obj,value,label)
{
obj.add(new Option(value,label));
}
function change()
{
var objSource =document.unitInfoForm.citycode;
removeAllListSource();
userarray = new Array();
userarray1= new Array();
deparray = new Array();
<%
for(int j=0;j<list2.size();j++)
{
out.println("userarray["+j+"]='"+((Citycode)list2.get(j)).getCityname()+"';");
out.println("userarray1["+j+"]='"+((Citycode)list2.get(j)).getCitycode()+"';");
out.println("deparray["+j+"]='"+((Citycode)list2.get(j)).getFlagpro()+"';");
}
%> for(var i=0;i<userarray.length;i++)
{
if (deparray[i]==document.unitInfoForm.provincecode.value || document.unitInfoForm.provincecode.value=="1000")
{
addtolist(objSource,userarray[i],userarray1[i]);
}
}
}
</script><html:select property="provincecode" style="width:90px;" value="北京" onchange="change()">
<html:select property="citycode" style="width:120px;" value="北京" >
解决方案 »
- 怎么在extjs4中给grid加多个toolbar?
- 高手帮帮忙,获取框架页的高度取不到值?
- 关闭showModalDialog
- textarea中显示默认内容,同时在中间单击鼠标后默认内容消失,填写完东西后,再次单击正常
- amcharts+jsf,IE8加载问题
- 怎么用javascript对页面里的字段进行排序 (特别的着急)
- 急!。js中的函数名何参数如何调用?返回值如何返回?
- javascript的绝对值函数是那一个
- 急急!!如何用循环得到名字后跟变量的JSP中提交的表单的值(在线等待)
- 如何让这个函数返回经纬度字符串? 我是新手,真是费了很多脑筋实在不行了。。。。请大家帮忙啊
- 对话框
- js如何实现点击 按钮一次增加增加文件域一个
{
var objSource = document.unitInfoForm.citycode;
if(objSource.length!=undefined && objSource.length >=0)
{
var objLen = objSource.length;
for (var i=0;i <objLen;i++)
{
if(objSource.options[i].value != noRemoveValue)
{
objSource.options.remove(i);
}
}
}
}
function addtolist(obj,value,label)
{
obj.add(new Option(value,label));
}
function change()
{
var objSource =document.unitInfoForm.citycode;
removeAllListSource();
userarray = new Array();
userarray1= new Array();
deparray = new Array();
<% for(int j=0;j <list2.size();j++)
{
out.println("userarray["+j+"]= ""+((Citycode)list2.get(j)).getCityname()+" ";");
out.println("userarray1["+j+"]= ""+((Citycode)list2.get(j)).getCitycode()+" ";");
out.println("deparray["+j+"]= ""+((Citycode)list2.get(j)).getFlagpro()+" ";");
}
% > for(var i=0;i <userarray.length;i++)
{
if (deparray[i]==document.unitInfoForm.provincecode.value ¦ ¦ document.unitInfoForm.provincecode.value=="1000")
{
addtolist(objSource,userarray[i],userarray1[i]);
}
}
}
</script > <html:select property="provincecode" style="width:90px;" value="北京" onchange="change()" >
<html:select property="citycode" style="width:120px;" value="北京" >
</BODY>
</HTML>