下拉框改变绑定文本框的内容

<p>数据: <br/><textarea  type="text" id="key2" name="key2" placeholder="数据" data-height="70"
                          style="height: 156px; overflow: hidden; width: 446px;" rows="10" cols="30"></textarea>
    <br/>
<tr>
    <td>选择</td>
    <td>
    <select id="ss" onchange="change(value)">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
    </select>
    </td>
</tr>
<script type="text/javascript">
    // document.getElementById("curl").value="http://172.16.11.35:8866/";
    function change(value) {
        if(value=="synjones.cloudcard.api.access_token.get"){
            document.getElementById("key2").value="1";
        }else if(value=="synjones.cloudcard.dev.signin"){
            document.getElementById("key2").value="2";
        }else if(value=="synjones.cloudcard.door.heartbeat") {
            document.getElementById("key2").value="3" ;
            }else if(value=="synjones.cloudcard.door.devList.get"){
                document.getElementById("key2").value="4";
            }else if(value=="synjones.cloudcard.door.tz.get"){
                document.getElementById("key2").value="5";
            }else{
                document.getElementById("key2").value="6";
            }
    }
</script>

posted @ 2022-05-25 15:47  freedomAndWind  阅读(63)  评论(0编辑  收藏  举报