//给你一个写好的类,你new下就可以了//tantaiyizu
/***Date:2007/12/18****/
window.inpect = function(parent ,width){ //基本属性 public
this.parent = (typeof parent == 'undefined')?document.body:parent;
this.width =  parseInt((typeof width == 'undefined')?130:width); //获取对象方法 private
var $ = function(el){
return (typeof el == 'object')?el:document.getElementById(el);
};

//初始化控件 private
this.init = function(){
var strHTML = "<div style='position:absolute;z-index:1;clip:rect(3 280 20 "+ this.width +");'>"
+ "<select id='sel' style='width:"+ (this.width+17) +"'></select>"
+ "</div>"
+ "<div style='position:absolute;z-index:2;'>"
+ "<input hideValue='' id='inp' style='width:"+ (this.width+17) +"; height:20;'>"
+ "</div>";
this.parent.innerHTML = strHTML;

};this.init();

//选中赋值 anonymous 
$("sel").onchange = function(){
$("inp").value = this.options[this.selectedIndex].text;
$("inp").hideValue = this.value;
};

//添加option public
this.addOption = function(text ,value){
var op= new Option(text ,value);
$("sel").options.add(op);
}; //给控件赋值 public
this.setValue = function(value){
$("inp").value = selOption(value);
$("inp").hideValue = value;
}; //获取控件值 public
this.getValue = function(){
return $("inp").hideValue;
}; //选中控件 private
var selOption = function(value){
if($("sel").options.length != 'undefined'){
for(var i=0;i<$("sel").options.length;i++){
if($("sel").options[i].value == value){
$("sel").options[i].selected = true;
return $("sel").options[i].text;
}
}
}
};
};