<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE>可编辑select</TITLE>
  <script >
     function selShiftDesc(desc){
    if(desc.options.selectedIndex!=0){
    var v=desc.value;
    var t=desc.options[desc.options.selectedIndex].text 
    var i= document.getElementByIdx_x_x_x("i");
    var n= document.getElementByIdx_x_x_x("n");
    i.value=t;
    n.value=v;
    }
  }
  function c(){
   var t  = document.getElementByIdx_x_x_x("i").value;
   alert(t);
  }
  </script>
 </HEAD>

 <BODY>
            <div style="position:relative;">  
               <span style="margin-left:100px;width:18px;overflow:hidden;">
             <select id ='r' style="width:118px;margin-left:-100px" onchange="selShiftDesc(this);">
        <Option value=-1>-请选择-</option>
        <Option value=1>n1</option>
        <Option value=2>n2</option>
        <Option value=3>n3</option>
        <Option value=4>n4</option>
        <Option value=5>n5</option>
        <Option value=6>n6</option>
        <Option value=7>n7</option>
        <Option value=8>n8</option>
        <Option value=9>n9</option>
        </select>
       </span>
            <input id="i" type='text' name="newswriter.notes" style="width:100px;position:absolute;left:0px;"/>

      </div>

       <input type='button' id="b" value='提交' onclick="c();"/>
 </BODY>
</HTML>

posted on 2014-05-09 17:06  milantgh  阅读(459)  评论(0编辑  收藏  举报