点击按钮将字符串放到一个文本框中怎样实现

解决方案 »

  1.   

    <script>
    function mytest()
    {
    document.all.test.value="你想要的字符串";
    }
    </script><input type="text" name="test" value="">
    <input type="button" name="but" value="点击" onclick="mytest()">
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <script>
    function myFun(msg)
    {
    var txt = document.getElementById("txt");
    txt.value = msg;
    }
    </script>
    </head><body>
    <input type="text" id="txt">
    <input type="button" onClick="myFun('一个小例子');" value="测试">
    </body>
    </html>
    呵呵 来晚了 不过还是贴出来。