<script language="javascript">
function changeValue(){
delOptions(document.form1.select,"false");
var tempvalue="/document.form1.txtID.value;
var" valKey=document.form1.valKey.value.split(";");
for(i=0;i<valKey.length;i++){
if(tempValue==""){
var aOption=new Option();
aOption.value=valKey[i];
aOption.text=valKey[i+1];
document.form1.select.add(aOption);
}else{
if(valKey[i+1].indexOf(tempValue,0)>=0){
var aOption=new Option();
aOption.value=valKey[i];
aOption.text=valKey[i+1];
document.form1.select.add(aOption);
}
}
i=i+1;
}
document.form1.select.disabled=false;
}
function delOptions(objDst,boolSet){
var len = objDst.length - 1;
if (boolSet=="true"){
for(i=objDst.length;i>=0;i--){
objDst.remove(i);
}
}
else{
for(i=len;i>0;i--){
objDst.remove(i);
}
}
objDst.disabled=true;
}
</script>
body:
<BODY onLoad="changeValue()">
<form name="form1" action="" method="">
<div id="Layer1" style="position:absolute; width:157px; height:40px; z-index:0; left: 121px; top: 70px;clip:rect(0,100,20,65)">
<select name="select" onChange=document.form1.txtID.value=this[selectedIndex].text>
<option value="/请选择..." selected>请选择...</option>
</SELECT>
</div>
<div id="Layer2" style="position:absolute; width:157px; height:40px; z-index:2; left: 120px; top: 69px">
<input name="txtID" type="text" size="10" onChange="changeValue()" border="none">
<input name="valKey" type="hidden" value="AAAA;1111;BBBB;2222;CCCC;3333">
</div>
</form>
</BODY>
posted on 2006-03-13 17:52
fadesea 阅读(376)
评论(0) 编辑 收藏 所属分类:
javascript