<script type="text/JavaScript" src="jquery-1.1.3.pack.js"></script><!--这里引入jquery的文件-->
<script type="text/javascript">
function add()
{
var tb=document.getElementById("myTable2");
var myRow = tb.insertRow();
myRow.insertCell().innerHTML="3243423";
}
/*------------*/
var key = window.event ? e.keyCode : e.which;
$(document).ready(function () {
$("#myTable2 tr").click(function () {
if (event.keyCode == 45)
{
$(this).clone(true).insertAfter(this);
}
});
});
</script>
<table border="1" width="200" id="myTable2">
</table>
<input type="button" onClick="add()" value="click me">
实现以上 $(this).clone(true).insertAfter(this);敲击“+”号键盘键,就可以复制加载。
------解决方案--------------------
- JScript code
<script type="text/javascript"> $(function () { $("#myTable2 tr ").bind({ "keydown":function(e){ var Key=e.keyCode||e.which||e.charCode; if (Key == 107 || Key == 187)//187是右边数字小键盘上的,107是左边退格键旁边的 { $(this).clone(true).insertAfter(this); } }, "click":function(e){ $(this).clone(true).insertAfter(this); } }) }); </script> <table border="1" width="200" style="width:200px;height:20px;" id="myTable2"> <tbody><tr tabindex="0"><td>原始内容</td></tr></tbody> </table>