<select onchange="change(this.value)">
<option value="" re=""></option>
<option value="1" re="A1">A</option>
<option value="2" re="B1">B</option>
<option value="3" re="C1">C</option>
<option value="4" re="D1">D</option>
<option value="5" re="E1">E</option>
</select>
<input name=reInput value="" readonly>
<script>
function change(value)
{
document.getElementById("reInput").value=value;
}
</script>在Chang()里面按例添加就行了,当然还可以判断是否非空

解决方案 »

  1.   


    <select onchange="change(this.value)">
    <option value="" re=""></option>
    <option value="1" re="A1">A</option>
    <option value="2" re="B1">B</option>
    <option value="3" re="C1">C</option>
    <option value="4" re="D1">D</option>
    <option value="5" re="E1">E</option>
    </select>
    <input name=reInput value="" readonly>
    <script>
    function change(value)
    {
    for(i=0;i<document.getElementsByTagName('text').length;i++){
    document.getElementsByTagName('text')[i].value=value;
    }
    }
    </script>
      

  2.   

    不好意思错了:

    <select onchange="change(this.value)">
    <option value="" re=""></option>
    <option value="1" re="A1">A</option>
    <option value="2" re="B1">B</option>
    <option value="3" re="C1">C</option>
    <option value="4" re="D1">D</option>
    <option value="5" re="E1">E</option>
    </select>
    <input name=reInput value="" readonly type="text">
    <input name=reInput value="" readonly type="text">
    <input name=reInput value="" readonly type="text">
    <input name=reInput value="" readonly type="text">
    <script>
    function change(value)
    {
    for(i=0;i<document.getElementsByName('reInput').length;i++){
    document.getElementsByName('reInput')[i].value=value;
    }
    }
    </script>
      

  3.   

    上面两位.这样出来的结果.在input中的值都是相同的.
    我想要的是不同的值.
      

  4.   

    你按照上面的思路对每一个不同的input设置不同的值就可以了。
    无非是加几条给input控件赋值的语句
    function change(value)
    {
    document.getElementById("reInput").value=value;
    document.getElementById("InputId1").value="";//这里写其他的值
    document.getElementById("InputId2").value="";//这里写其他的值}
      

  5.   

    楼上的.
    你这样的写法.选其它项时.inputid1,2的值都是一样的.固定了值.我需要的是,当选A时,input值分别是1,2,3.选B时.input值是a,b,c这样的效果.
      

  6.   

    <select onchange="a(this)">function a(s)
    {
    v = s.options[s.selectedIndex].value
    if( v == "1")
    {
     document.getElementById("inputID").value="1,2,3"
    }
    if( v == "2")
    {
     document.getElementById("inputID").value="a,b,c"
    }
    }
      

  7.   

    <select onchange="document.all.reInput.value=this[this.selectedIndex].re;document.all.re2Input.value=this[this.selectedIndex].re2;">
    <option value="" re="" re2=""></option>
    <option value="1" re="A1" re2="天">A</option>
    <option value="2" re="B1" re2="地">B</option>
    <option value="3" re="C1" re2="玄">C</option>
    <option value="4" re="D1" re2="黄">D</option>
    <option value="5" re="E1" re2="宇">E</option>
    </select>
    <input name=reInput value="" readonly>
    <input name=re2Input value="" readonly>
      

  8.   

    数量不多的话,就每个input给个id,写死
      

  9.   

    用re这样的语法只有在windows的IE下才可以用。我们可以在javascript中定义一个变量:var arr = {
       "1":"a1",
       "2":"b1",
       "3":"c1"
    }这样就可以用 arr[indexId] 来取出上面变量里的值了。
    注: indexId是下拉列表的value值,是用参数传过来的
      

  10.   

    自定义属性firefox下用obj.getAttribute("rexxx");
      

  11.   

    建议结合SeeYouInTheSky的意见。