我的程序中要实现省市联动,可是为什么总是出现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="北京" >
解决方案 »
- 动态改变背景图没反应。
- 认证信息存储在哪里?
- display:none 后为什么img 的宽度为0?
- ---- >.<救命了!■程序完全「不执行」!!~!<javascript>...!
- 急!!!关于如何将document.all改写成document.getElementById的问题?迷糊很长时间.
- 如何实现这样的功能呢?(类似网页特效)
- el.addListener提示el.addListener is not a function
- javascript中如何判断prompt所输入的值为空,或判断其被取消?
- 怎么使<div>始终可见?
- 如何实现公告板滚屏中鼠标指向即停止?
- 对话框
- 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>