日期:2014-05-17 浏览次数:20785 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script> var i=0 function b(){ var m=obj.parentElement.parentElement.rowIndex+1; m.removeAttribute("readOnly"); } function insert_row(){ i ++ R = tbl.insertRow() C = R.insertCell() C.innerHTML = "第"+i+"个文件" C = R.insertCell() C.innerHTML = "<input value='123' readOnly ondblclick='b();'>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "项目动态" C = R.insertCell() C.innerHTML = "<input >" } function deleteRow(obj){ var flag=confirm("请问要确认删除吗?") if(flag){ // alert(obj.parentElement.parentElement.rowIndex+1); tbl.deleteRow(obj.parentElement.parentElement.rowIndex); } } </script> </HEAD> <BODY> <form> <input type='button' value='删除' onclick='deleteRow(this)'> </form> <input type="button" value="插入" onclick="insert_row()"> <table name='tbl' id="tbl" border="1" width=300> </table> </BODY> </HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script> var i=0; var selectedRow; function b(){ var m=obj.parentElement.parentElement.rowIndex+1; m.removeAttribute("readOnly"); } function insert_row(){ i ++ R = tbl.insertRow() ; R.onclick = function (){ this.style.backgroundColor = "red"; selectedRow = this; } C = R.insertCell() C.innerHTML = "第"+i+"个文件" C = R.insertCell() C.innerHTML = "<input value='123' readOnly ondblclick='b();'>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "<input value='123' readonly>" C = R.insertCell() C.innerHTML = "项目动态" C = R.insertCell() C.innerHTML = "<input >" } function deleteRow(obj){ if(!selectedRow){ alert("请选择"); } var flag=confirm("请问要确认删除吗?") if(flag){ // alert(obj.parentElement.parentElement.rowIndex+1); alert(selectedRow.innerHTML);