var Arrchange1 =new Array ();
var Arrchange2 =new Array ();
var Arrchange3 =new Array ();
function hide(s_id,index)
{
var xxx = document .getElementById (s_id);
var oldOption = xxx.children(index);
var oldStr = oldOption.innerText;
var newOption = document.createElement(‘<div’ + oldOption.outerHTML.match(/(<w*)([^>]*)(>)/)[2] +’>’);
newOption.innerText= oldStr;
newOption.swapNode(oldOption);
//alert(xxx.innerHTML);
}
function show(s_id,index)
{
var xxx =document .getElementById (s_id);
var oldOption = xxx.children(index);
if(oldOption.tagName==’DIV’)
{
var oldStr = oldOption.innerText;
var newOption = document.createElement(‘<option’ + oldOption.outerHTML.match(/(<w*)([^>]*)(>)/)[2] +’>’);
newOption.innerText = oldStr;
newOption.swapNode(oldOption);
}
//alert(xxx.innerHTML);
}
function onchange1()
{
var s_index=document .getElementById (“Ddl_question1”).options[document .getElementById (“Ddl_question1”).selectedIndex].value;
s_index = parseInt(s_index);
if(s_index ==0)
{
show (‘Ddl_question2’,Arrchange1 [0] );
show (‘Ddl_question3’,Arrchange1 [0] );
Arrchange1.pop();
}
else
{
Arrchange1.push(s_index);
if(Arrchange1.length>0)
{
show (‘Ddl_question2’,Arrchange1 [0] );
}
if(Arrchange1.length>0)
{
show (‘Ddl_question3’,Arrchange1 [0] );
}
hide(‘Ddl_question2’,s_index);
hide(‘Ddl_question3’,s_index);
}
}
function onchange2()
{
var s_index=document .getElementById (“Ddl_question2”).options[document .getElementById (“Ddl_question2”).selectedIndex].value;
s_index = parseInt(s_index);
if(s_index ==0)
{
show (‘Ddl_question1’,Arrchange1 [0] );
show (‘Ddl_question3’,Arrchange3 [0] );
Arrchange2.pop();
}
else
{
Arrchange2.push(s_index);
if(Arrchange2.length>0)
{
show (‘Ddl_question1’,Arrchange2 [0] );
}
if(Arrchange2.length>0)
{
show (‘Ddl_question3’,Arrchange2 [0] );
}
hide(‘Ddl_question1’,s_index);
hide(‘Ddl_question3’,s_index);
}
}
function onchange3()
{
var s_index=document .getElementById (“Ddl_question3”).options[document .getElementById (“Ddl_question3”).selectedIndex].value;
s_index = parseInt(s_index);
if(s_index ==0)
{
show (‘Ddl_question1’,Arrchange3 [0] );
show (‘Ddl_question2’,Arrchange3 [0] );
Arrchange3.pop();
}
else
{
Arrchange3.push(s_index);
if(Arrchange1.length>0)
{
show (‘Ddl_question1’,Arrchange3 [0] );
}
if(Arrchange2.length>0)
{
show (‘Ddl_question2’,Arrchange3 [0] );
}
hide(‘Ddl_question1’,s_index);
hide(‘Ddl_question2’,s_index);
}
}
function a() {alert(“fuck “);}
</script>
<select name=”Ddl_question1″ id=”Ddl_question1″ onchange=”onchange1()”>
<option value=”0″>请选择密保信息</option>
<option value=”1″>您母亲的姓名是?</option>
<option value=”2″>您父亲的姓名是?</option>
<option value=”3″>您配偶的姓名是?</option>
<option value=”4″>您的出生地是?</option>
<option value=”5″>您高中班主任的姓名是?</option>
<option value=”6″>您初中班主任的姓名是?</option>
<option value=”7″>您小学班主任的姓名是?</option>
<option value=”8″>您小学校名是?</option>
<option value=”9″>您的学号(或工号)是?</option>
<option value=”10″>您父亲的生日是?</option>
<option value=”11″>您母亲的生日是?</option>
<option value=”12″>您配偶的生日是?</option>
</select>
<select name=”Ddl_question2″ id=”Ddl_question2″ onchange=”onchange2()”>
<option value=”0″>请选择密保信息</option>
<option value=”1″>您母亲的姓名是?</option>
<option value=”2″>您父亲的姓名是?</option>
<option value=”3″>您配偶的姓名是?</option>
<option value=”4″>您的出生地是?</option>
<option value=”5″>您高中班主任的姓名是?</option>
<option value=”6″>您初中班主任的姓名是?</option>
<option value=”7″>您小学班主任的姓名是?</option>
<option value=”8″>您小学校名是?</option>
<option value=”9″>您的学号(或工号)是?</option>
<option value=”10″>您父亲的生日是?</option>
<option value=”11″>您母亲的生日是?</option>
<option value=”12″>您配偶的生日是?</option>
</select>
<select name=”Ddl_question3″ id=”Ddl_question3″ onchange=”onchange3()”>
<option value=”0″>请选择密保信息</option>
<option value=”1″>您母亲的姓名是?</option>
<option value=”2″>您父亲的姓名是?</option>
<option value=”3″>您配偶的姓名是?</option>
<option value=”4″>您的出生地是?</option>
<option value=”5″>您高中班主任的姓名是?</option>
<option value=”6″>您初中班主任的姓名是?</option>
<option value=”7″>您小学班主任的姓名是?</option>
<option value=”8″>您小学校名是?</option>
<option value=”9″>您的学号(或工号)是?</option>
<option value=”10″>您父亲的生日是?</option>
<option value=”11″>您母亲的生日是?</option>
<option value=”12″>您配偶的生日是?</option>
</select>
以上就是【dropdownlist之间的互相联动实现(显示与隐藏)】的全部内容了,欢迎留言评论进行交流!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
8. 精力有限,不少源码未能详细测试(解密),不能分辨部分源码是病毒还是误报,所以没有进行任何修改,大家使用前请进行甄别
丞旭猿论坛
暂无评论内容