日期:2014-05-17  浏览次数:20848 次

不刷新得到下框列表框的值???特急啊!!!!
目的:
      如:   选择国家               选择地区               选择市             提交


        国家,地区或市数据库分别为,gj,dq,shi.

问:如果在我选择国家的时候,地区列表框中会得到所在国家的地区?市县同地区一样?

------解决方案--------------------
<SCRIPT LANGUAGE= "JavaScript ">
<!--
function CreateSelect(_FormName,_SName,_SValue,_Ds,_AllOptionStr,ShowType)
{
//三级关链菜单通用版
//作者:海娃, 有问题请到http://www.51windows.Net留言。
if (_FormName== " ")
_FormName = "all "
var _DsArr = _Ds.split( "| ")
var _Ds1,_Ds2,_Ds3
var _Ds1 = _DsArr[0]
var _Ds2 = (_DsArr.length> 1)?_DsArr[1]:_DsArr[0]
var _Ds3 = (_DsArr.length> 2)?_DsArr[2]:_DsArr[0]

var _SNameArr = _SName.split( "| ")
var _SName1,_SName2,_SName3
var _SName1 = _SNameArr[0]
var _SName2 = (_SNameArr.length> 1)?_SNameArr[1]:_SNameArr[0]
var _SName3 = (_SNameArr.length> 2)?_SNameArr[2]:_SNameArr[0]

var _SValueArr = _SValue.split( "| ")
var _SValue1,_SValue2,_SValue3
var _SValue1 = _SValueArr[0]
var _SValue2 = (_SValueArr.length> 1)?_SValueArr[1]:_SValueArr[0]
var _SValue3 = (_SValueArr.length> 2)?_SValueArr[2]:_SValueArr[0]

if (ShowType==3){
_AllOptionStr = _AllOptionStr.replace(/\(\(/ig, "\(\( "+_Ds3+ "\^ ")
_AllOptionStr = _AllOptionStr.replace(/\{\{/ig, "\{\{ "+_Ds2+ "\(\( "+_Ds3+ "\*\* ")
}
else if(ShowType==2){
_AllOptionStr = _AllOptionStr.replace(/\{\{/ig, "\{\{ "+_Ds2+ "\(\( "+_Ds3+ "\*\* ")
}
else if(ShowType==1){
_AllOptionStr = _AllOptionStr.replace(/\(\(/ig, "\(\( "+_Ds3+ "\^ ")
}
var AllStr = _Ds1 + "{{ "+ _Ds2 + "(( "+ _Ds3 + "|| "+_AllOptionStr
//alert(AllStr)
var _AR0 = AllStr.split( "|| ");
document.writeln( " <select name=\ " " + _SName1 + "\ " size=\ "1\ " onChange=\ " "+_SName1+ "redirect(this.options.selectedIndex)\ "> ");
for (var i1 = 0;i1 < _AR0.length;i1++)
{
var Area1Str = _AR0[i1];
var _AR10 = Area1Str.split( "{{ ");
var _AR11 = _AR10[0].split( "@ ");
var Tstr1 = _AR11[0];
var Vstr1 = (_AR11.length==2)?_AR11[1]:_AR11[0]
document.writeln( " <option value=\ " "+Vstr1+ "\ "> "+Tstr1+ " <\/option> ");
}
document.writeln( " <\/select> ");

document.writeln( " <select name=\ " " + _SName2 + "\ " size=\ "1\ " onChange=\ " "+_SName1+ "redirect1(this.options.selectedIndex)\ "> ");
var _AR111 = _Ds2.split( "@ ");
var Tstr11 = _AR111[0];
var Vstr11 = (_AR111.length==2)?_AR111[1]:_AR111[0];
document.writeln( " <option value=\ " "+Vstr11+ "\ "> "+Tstr11+ " <\/option> ");
document.writeln( " <\/select> ");

document.writeln( " <select name=\ " " + _SName3 + "\ " size=\ "1\ "> ");
var _AR222 = _Ds3.split( "@ ");
var Tstr22 = _AR222[0];
var Vstr22 = (_AR222.length==2)?_AR222[1]:_AR222[0];
document.writeln( " <option value=\ " "+Vstr22+ "\ "> "+Tstr22+ " <