var?intIndex=0;arrList?=?new?Array();?
function?test()??
{?
?????
????dearray("1111,222,222a,aaa,aa1,bb,b222,b3,323313,3213,32213,dsfsdddd");?
????smanPromptList(arrList,"inputer1");?
????smanPromptList(arrList,"inputer2");?
????smanPromptList(arrList,"inputer3")?
}?
????
function?dearray(aa)//¶¨Òåarray?
{?
????arrList?=?aa.split(¡¯,¡¯);?
?????
}?
function?getAbsoluteWidth(ob)?
{?
????????return?ob.offsetWidth?
}?
function?smanPromptList(arrList,objInputId){?
????????var?objouter=document.getElementById("__smanDisp")?//ÏÔʾµÄDIV¶ÔÏó?
????????var?objInput?=?document.getElementById(objInputId);?//Îı¾¿ò¶ÔÏó?
????????var?selectedIndex=-1;?
????????var?intTmp;?//Ñ»·ÓõÄ:)?
????????if?(objInput==null)?{alert(¡¯smanPromptList³õʼ»¯Ê§°Ü:ûÓÐÕÒµ½"¡¯+objInputId+¡¯"Îı¾¿ò¡¯);return?;}?
????????????//Îı¾¿òʧȥ½¹µã?
????????????objInput.οnblur=function(){?
????????????????objouter.style.display=¡¯none¡¯;?
????????????}?
????????????//Îı¾¿ò°´¼ü̧Æð?
????????????objInput.οnkeyup=checkKeyCode;?
????????????//Îı¾¿òµÃµ½½¹µã?
????????????objInput.οnfοcus=checkAndShow;?
????????????function?checkKeyCode(){?
????????????????var?ie?=?(document.all)??true:false?
????????????????if?(ie){?
????????????????????var?keyCode=event.keyCode?
????????????????????if?(keyCode==40||keyCode==38){?//ÏÂÉÏ?
????????????????????????var?isUp=false?
????????????????????????if(keyCode==40)?isUp=true?;?
????????????????????????chageSelection(isUp)?
????????????????????}else?if?(keyCode==13){//»Ø³µ?
????????????????????????outSelection(selectedIndex);}else{?
????????????????????????checkAndShow()?
????????????????????}?
????????????????}else{?
????????????????????checkAndShow()?
????????????????}?
????????????????divPosition()?
????????????}?
????????????function?checkAndShow(){?
????????????????????????var?strInput?=?objInput.value?
????????????????????????if?(strInput!=""){?
????????????????????????????divPosition();?
????????????????????????????selectedIndex=-1;?
????????????????????????????objouter.innerHTML?="";?
????????????????????????????for?(intTmp=0;intTmp<arrlist.length;inttmp++){?>
????????????????????????????????if?(arrList[intTmp].substr(0,?strInput.length)==strInput){?
????????????????????????????????????addOption(arrList[intTmp]);?
????????????????????????????????}?
????????????????????????????}?
????????????????????????????objouter.style.display=¡¯¡¯;?
????????????????????????}else{?
????????????????????????????objouter.style.display=¡¯none¡¯;?
????????????????????}function?addOption(value){?
????????????????????????objouter.innerHTML?+="<div?οnmοuseοver="this.classname=¡¯sman_selectedstyle¡¯"?οnmοuseοut="this.classname=¡¯¡¯"?οnmοusedοwn="document.getelementbyid(¡¯"+objinputid+"¡¯).value=¡¯"?+?value?+?"¡¯">"?+?value?+?"
"?????
????????????????????}?
????????????}?
????????????function?chageSelection(isUp){?
????????????????if?(objouter.style.display==¡¯none¡¯){?
????????????????????objouter.style.display=¡¯¡¯;?
????????????????}else{?
????????????????????if?(isUp)?
????????????????????????selectedIndex++?
????????????????????else?
????????????????????????selectedIndex--?
????????????????}?
????????????????var?maxIndex?=?objouter.children.length-1;?
????????????????if?(selectedIndex<0){selectedIndex=0}?
????????????????if?(selectedIndex>maxIndex)?{selectedIndex=maxIndex}?
????????????????for?(intTmp=0;intTmp<=maxIndex;intTmp++){?
????????????????????if?(intTmp==selectedIndex){?
????????????????????????objouter.children[intTmp].className="sman_selectedStyle";?
????????????????????}else{?
????????????????????????objouter.children[intTmp].className="";?
????????????????????}?
????????????????}?
????????????}?
????????????function?outSelection(Index){?
????????????????objInput.value?=?objouter.children[Index].innerText;
objouter.style.display=¡¯none¡¯;?
????????????}?
????????????function?divPosition(){?
????????????????var?clx,cly;?
????????????????clx=event.clientX;?
????????????????cly?=?event.clientY;?
????????????????objouter.style.top????=?cly+10;?
????????????????objouter.style.left????=?clx+20;??
????????????????objouter.style.width=?getAbsoluteWidth(objInput)?
????????????}?
????}?
????document.write("<div?id=¡¯__smandisp¡¯?style=¡¯;display:none;background:#e8f7eb;border:?1px?solid?#cccccc;font-size:14px;cursor:?default;¡¯?onbulr>?
");?
????document.write(" <style>.sman_selectedStyle{background-Color:#102681;color:#FFFFFF}</style> ");?
id="table1"?style="BORDER-COLLAPSE:?collapse"??></div?id=¡¯__smandisp¡¯?style=¡¯;display:none;background:#e8f7eb;border:?1px?solid?#cccccc;font-size:14px;cursor:?default;¡¯?onbulr>