//---------------------------------- DropDownListx.js--------- function DropDownListx(parent,id) { this.id = id var i; var me = this; var e = this.parent; var x = e .offsetLeft; this.text = e.value; while(e = e.offsetParent) { y = e.offsetTop x = e.offsetLeft; >this.parentInfo = {x:0,y:0}; this.parentInfo.x = x; this.parentInfo.y = y //Appearance this .width = this.parent.offsetWidth; this.height = 150; this.disabled = false; this.visibility = "hidden";//data 속성으로 표현하면 노드로도 표현할 수 있습니다 this.mainText = "";//표시할 필드 이름 this.mainValue = "";//필드 이름 반환할 값 this.selectedIndex = -1;//선택한 인덱스 this.mouseoverIndex = -1;//마우스를 올렸을 때의 인덱스 this.mouseoutIndex = -1;// 마우스가 나갈 때의 인덱스 this.selectedValue = ""; this.selectedText = ""; this.value = ""; .drawed = false; // 다시 그려졌습니까? this.table = null //데이터 소스 this.dataSource = try { (i = 6;i>0; i--) { 시도 { this.dataSource = new ActiveXObject("MSXML2.DOMDocument." i ".0"); >break; } catch(ex1){;}; } } catch(ex2){;}; >this.dataSource.setProperty(" SelectionLanguage ", "XPath"); var sh = function(){if(me.visibility == "hidden")me.show();} this. parent.attachEvent("onfocus", function (){window.setTimeout(sh,100);}) this.parent.attachEvent("onchange",function(){me.filter(me.parent.value );}); this .parent.attachEvent("onkeyup",function(){me.filter(me.parent.value);}) this.parent.attachEvent("onclick",function (){if(event.button = "1")window.setTimeout(sh,10);}) this.parent.style.cursor = "hand" //이벤트 this.onSelected=null; this.onmouseover = null; this.onhide = null; window.document.attachEvent("onclick",function() { //예 e가 맨 위에 있지 않을 수도 있으므로 해당 영역을 찾으세요 if(event.x < me.parentInfo.x || event.x > me.parentInfo. x me.parent.offsetWidth || event.y < me.parentInfo.y || event.y > me.parentInfo.y me.parent.offsetHeight) { (me.visibility == "visible " ) me.hide(); } }) } //부모 위치가 바뀔 수 있으므로 위치를 다시 획득하세요 DropDownListx.prototype.getPosition=function ( ) { var e = this.parent; var y = e.offsetTop; var x = e.offsetLeft; e.offsetParent) { y = e.offsetTop; x = e.offsetLeft } this.parentInfo = {x:0,y:0}; this.parentInfo.x = x; this.parentInfo.y = y; this.width = this.parent.offsetWidth; }//목록 그리기 .show=function() { this.getPosition(); var me = this //div 그리기 var divid = this.id "_div_" this.parent .id; var d = document.getElementById(divid); if(d==null) { d = document.createElement("div") d.style .position = "절대"; } d.style.borderLeft = "검은색 1px 홈"; d.style.borderTop = "검은색 1px 홈" d.style.borderRight = "검은색 1px 홈"; document.body.appendChild(d); d.setAttribute("id",divid) d.style.borderBottom = "검은색 1px 홈"; d.style.BackgroundColor = " 흰색 "; d.style.left = this.parentInfo.x "px" if(document.body.clientHeight < this.parentInfo.y this.parent.offsetHeight this.height) d .style.top = (this.parentInfo.y - this.height) "px"; else d.style.top = (this.parentInfo.y. parent.offsetHeight=="" ? 20:this.parent.offsetHeight)) "px"; d.style.overflowX = "숨김"; d.style.overflowY = "자동"; d.style.zIndex = 999; d.style.visibility = "visible"; d.style.borderWidth = "1px"; this.visibility = "visible"; listData(); this ._selectByName(this.parent.value); } DropDownListx.prototype.listData() { var e = this.parent; >var base = this //데이터 표시 if(this.nodeList == null) this.nodeList = this.dataSource.documentElement.childNodes var str="
"; for(var i = 0;i{ var text = (base.attributed?this.nodeList.item(i).getAttribute(this.mainText):this.nodeList.item(i).selectSingleNode(this. mainText).text); str = str "