combox.prototype.change=function(){ /*定義下拉框的onchange事件*/ var inputbox=document.getElementsByName("combox_"+this.name)[0] inputbox.value=this.select.options[this.select.selectedIndex].text; with(inputbox){select();focus()}; } ////////對象事件結束/////// /*公用定位函數(獲取控件絕對坐標)*/ function getL(e){ var l=e.offsetLeft; while(e=e.offsetParent)l+=e.offsetLeft; return l } function getT(e){ var t=e.offsetTop; while(e=e.offsetParent)t+=e.offsetTop; return t } /*結束*/ </script> <script language="javascript"> var a=new combox("a","fason") a.init() </script>