让下拉列表select可编辑的简便方法 2

下拉列表select可编辑的简便方法 1:

 

<div   style="position:relative;"> 
  <span   style="margin-left:100px;width:18px;overflow:hidden;"> 
  <select id='FROM_VALUE'   style="width:118px;margin-left:-100px"   onchange="this.parentNode.nextSibling.value=this.value"> 
  <option   value="aaaa">   aaaa   </option> 
  <option   value="bbbb">   bbbb   </option> 
  <option   value="cccc">   ccccc   </option> 
  </select></span><input   name="FROM_VALUE"   style="width:100px;position:absolute;left:0px;"> 
  </div>

 

 

下拉列表select可编辑的简便方法 2:

 

  <div   style="position:relative;">
  <span   style="margin-left:100px;width:18px;overflow:hidden;">
  <select name="FROM_VALUE" id='FROM_VALUE'   style="width:118px;margin-left:-100px" >
  </select></span><input   name="FROM_VALUE_HID" id="FROM_VALUE_HID" style="width:100px;position:absolute;left:0px;">
  </div>

 

    var from_sel=document.getElementById('FROM_VALUE');
    var from_hid=document.getElementById('FROM_VALUE_HID');
    from_hid.type = "hidden";
    hasElement = false;

    if (hasElement == false) {
     from_sel.name = "FROM_VALUE_SEL";
     from_hid.name = "FROM_VALUE";
     from_hid.type = "text";
    } else {
     from_sel.name = "FROM_VALUE";
     from_hid.name = "FROM_VALUE_HID";
     from_hid.type = "hidden";
    }

 

你可能感兴趣的:(div)