解决方案 »

  1.   

    测试时可以的啊。<!DOCTYPE html>
    <html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
    </script>
    <script>
    $(document).ready(function(){
      $("p").click(function(){
      $("#demoTable").append("<input type='button' id='btn1' value='按扭' onclick='test(this)' />");
      });
    });
    function test(e) {
                   alert($(e).attr('id'));
                $(e).hide();
            } 
    </script>
    </head>
    <body>
    <table id="demoTable">
    </table>
    <p>如果您点击我,我会消失。</p>
    <p>点击我,我会消失。</p>
    <p>也要点击我哦。</p>
    </body>
    </html>
      

  2.   


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type='text/javascript'>
    $(function(){
    for(var i=0;i<5;i++){
    $('#demoTable').append("<tr><td><input name='' type='button' value='test'/></td></tr>");
    }
    $('#demoTable input').live('click',function(){
    alert(123);
    });
    })
    </script><table id="demoTable">
    </table>
      

  3.   


    我刚才换了firefox,发现可以实现了,可是ie就没有反应,有什么办法让ie也有效果呢?谢谢
      

  4.   

    1楼的要改一改:
    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
    </script>
    <script>
    $(document).ready(function(){
      $("p").click(function(){
      $("#demoTable").append("<tr><td><input type='button' id='btn1' value='按扭' onclick='test(this)' /></td></tr>");
     
     
      });
    });
    function test(e) {
                   alert($(e).attr('id'));
                $(e).hide();
            } 
    </script>
    </head>
    <body>
    <table id="demoTable">
    </table>
    <p>如果您点击我,我会消失。</p>
    <p>点击我,我会消失。</p>
    <p>也要点击我哦。</p>
    </body>
    </html>
      

  5.   


    恩,我改过来了,可是现在还是在firefox下可以实现了,ie就没有反应,有什么办法让ie也有效果呢?谢谢 
      

  6.   

    一行行对应可以用$("#ID").each(function(i){$(this).next(); //获取下一个元素的内容$(this).click(function(){
    });
    });这样既可以给每行绑上事件,有可以根据每行的ID进行不同的处理