<input type=text id=tid>
<img src=1.gif onclick="tid.value=tid.value+'1';tid.focus()">
<img src=2.gif onclick="tid.value=tid.value+'2';tid.focus()">

解决方案 »

  1.   

    <input type=text id=tid>
    <img src=1.gif onmousedown="tid.value++"> try:onclick==>onmousedown
      

  2.   

    也可以这样:
    <input type=text id=tid onblur="this.focus()">
    <img src=1.gif onclick="tid.value=tid.value+'1'">
    <img src=2.gif onclick="tid.value=tid.value+'2'">
    另外,请问阿信,onclick改成onmousedown有什么实际意义吗?
    我觉得好象无所谓。
      

  3.   

    try:
    <input><input type=button onclick="alert(activeElement.value)" value=a><input type=button onmousedown="alert(activeElement.value)" value=b>
    you'll see the difference
      

  4.   

    使用下面的代码:
    <script language=javascript>
    var curInput=null;
    function setChar(obj){
    if(curInput!=null)
    curInput.value+=obj.src;
    }
    </script>
    <input ... onblur="javascript:curInput=this;">
    <input ... onblur="javascript:curInput=this;">
    <input ... onblur="javascript:curInput=this;">
    <input ... onblur="javascript:curInput=this;">
    <img ... onclick="setChar(this)">