国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

dropdownlist之間的互相聯動實現(顯示與隱藏)

2024-05-06 14:12:46
字體:
來源:轉載
供稿:網友
代碼如下:
<script language="javascript" type ="text/javascript" >

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()">
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 苏州市| 灵宝市| 柞水县| 江油市| 廉江市| 凭祥市| 新乐市| 保康县| 平凉市| 麻阳| 菏泽市| 甘肃省| 威宁| 盐津县| 东安县| 靖宇县| 林甸县| 抚宁县| 甘孜| 郑州市| 庆城县| 开化县| 博湖县| 海口市| 崇礼县| 犍为县| 泉州市| 黎平县| 高州市| 镶黄旗| 湘西| 集安市| 依安县| 栖霞市| 宁波市| 南投市| 上高县| 琼海市| 西和县| 辽宁省| 达孜县|