在同一个页面上有两个table 
第一个table里面有一个
<td>价格</td>
<td>
    <input class="inputtext" name="price" onkeydown="fooatonly(this);">
</td>
下面的table:
<td>价格</td>
<td>``````</td>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
要在上面的<td>里面输入数字的时候在下面的<td>里面要显示出来·····求高手····

解决方案 »

  1.   

    下面的table:
    <td>价格</td>
    <td><span id="span_price"></span></td>事件修改onkeydown=》onkeyup,即onkeyup="fooatonly(this);"JS
    function fooatonly(obj)
    {
     var price=$(obj).val();
    $("#span_price").text(price);
    }
    }
      

  2.   

    或者这样
      $(document).ready(function () {
     var txtone = $("input[class*=inputtext]");
    txtone.keyup(function () { 
    var price=txtone.val(); 
    $("#dierge_price").text(price);});
       });
      

  3.   

    不是的···我上面的onkeydown=“return floatOnly(this);”是用来控制输入只输入数字的···不用修改这个js,那其他的怎么改?
      

  4.   

    不是的···我上面的onkeydown=“return floatOnly(this);”是用来控制输入只输入数字的···不用修改这个js,那其他的怎么改?
      

  5.   

    <html>
    <head>
    <title>aaaa</title>
    <script type="text/javascript"> 
    function gg(){
    document.getElementById("td1").innerText=document.getElementById("price").value;
    }
    </script>
    </head>
    <body>
    1231312332131
    <table>
    <tr>
    <td>aaa</td>
    <td>
      <input class="inputtext" id="price" name="price" onkeyup="gg();">
    </td>
    <td>bbb</td>
    <td id="td1"></td>
    </tr>
    </table>
    </body>
    </html>再加一个onkeyup呗
      

  6.   

    在加个keyup事件就可以了keydown="return floatOnly(this)"  keyup="showprice(this)"showprice就是上面的方法
      

  7.   

    我这样写进去··报错啊···· Microsoft Jsccript runtime error :‘undefined’is null or not an object
      

  8.   


    他那是用了jquery,你引用jquery文件了么。 没用的话,看看我的,不用jquery也行啊
      

  9.   

    说让你加方法嘛,咋转不过弯咧,onkeydown就还是用你的方法fooatonly,只不过加一个onkeyup嘛 
     <input class="inputtext" name="price" onkeydown="fooatonly(this); onkeyup="gg();">
      

  10.   

    我加了啊····在这个<input>里面两个框是可以关联的,我在上面输入,在下面也是可以显示的···
    可是在另外一个<input>里面,按照上面的方法,我输入的是字母和汉字却会报错····