现有文本框,我想通过点击按钮为其赋值。并且文本框为不可编辑状态。只能通过按钮为其赋值。例如点击按钮test,点击之后,在文本框中要使“test”自动填入文本框中。请问大家如何实现此功能。

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script type="text/javascript" charset="gbk">
    function onClikebut() {
        
    document.getElementById("asd").value="asdasdasdasd";
    return false;
    }
    </script>
    </head><body>
    <input type="text" name="asd" id="asd" readonly="readonly"/>
    <input name="" type="button" onclick="onClikebut();return false;"/>
    </body>
    </html>
    你看看能用不?