pengyue-form 模块 dropdown 关系联动

<script>

window.onload=function()
{
	 var school= document.getElementById("dnn_ctr5973_ViewPengYueFormSystem_Customer1");
	 var special= document.getElementById("dnn_ctr5973_ViewPengYueFormSystem_Customer2");
	 var specialTmp=[];
	 
	for(var i=0;i<special.options.length;i++)
	{
		specialTmp[i]=special.options[i].value;
	}
	


	 school.onchange=function()
	 {
		 var currentValue=school.options[school.selectedIndex].value;
		
		//删除special
			for(var i=special.options.length-1;i>=0;i--)   
			{
				special.options.remove(i);  //循环删除所有子元素
			}
			
		//添加所属院校的
		for(var i=0;i<specialTmp.length;i++)
		{
			if(specialTmp[i].indexOf(school.options[school.selectedIndex].value)>=0)
			{
				var tmp=specialTmp[i].split("-");
				var tmp1=tmp[tmp.length-1]
				special.options.add(new Option(tmp1,tmp1));
			}
		}
	 }
}
</script>

 

posted @ 2016-07-13 16:18  王鹏飛  阅读(173)  评论(0编辑  收藏  举报