<BODY>
<textarea id=theT></textarea><br>
<button onclick="theT.value='a'">a</button>&nbsp;
<button onclick="theT.value='b'">b</button>&nbsp;
<button onclick="theT.value='c'">c</button>&nbsp;
<button onclick="theT.value='d'">d</button>&nbsp;</BODY>

解决方案 »

  1.   

    <input type=text id=disp>
    <input type=button value=a onclick="disp.value=this.value">
    <input type=button value=b onclick="disp.value=this.value"><input type=button value=c onclick="disp.value=this.value"><input type=button value=d onclick="disp.value=this.value">
      

  2.   

    <input type=text name=test size=12><br>
    <input type=button value="a" onclick="document.all.test.value=this.value">
    <input type=button value="b" onclick="document.all.test.value=this.value">
    <input type=button value="c" onclick="document.all.test.value=this.value">
    <input type=button value="d" onclick="document.all.test.value=this.value">
      

  3.   

    先谢谢各位,你们的方法其实都一个意思
    都不能实现我想要的功能,难道你们都没调试。
    你们点击的时候只闪一下就过了,根本没有赋值给text
    请各位再帮忙看看,!!!
      

  4.   

    不好意思再补充一下,我的按钮不是button
    而是一个image按钮,所以每次都把值刷新了一下,变成空的!!!
      

  5.   

    估计是你提交了表单,页面刷新所致,注意onclick的时候不要submit
      

  6.   

    哦。我明白你的意思了。
    其实<input type=image> 和 <input type=submit> 是一样的呀。所以你按一下就提交了一次。 :)看看下面的例子(有图片,要稍等会)<BODY>
    <form>
    <textarea id="theT" cols="40" rows="10"></textarea><br><br><input alt=dd src="http://webmail.0-100.com.cn/images/button-addon.gif" type="image" border="0" width="61" height="19" onclick="theT.value='a';return false;">&nbsp;&nbsp;<input src="http://webmail.0-100.com.cn/images/button-send.gif" type="image" border="0" width="61" height="19" onclick="theT.value='b';return false;">&nbsp;&nbsp;<input src="http://webmail.0-100.com.cn/images/button-cancel.gif" type="image" border="0" width="61" height="19" onclick="theT.value='c';return false;">&nbsp;&nbsp;
    </form>
    </BODY>