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>