js如何删除分页的数据

JavaScript08

js如何删除分页的数据,第1张

function goDeleteAll(){

var pages= $("totalPages").value

for(var j=pagesj>0j--){

var nodes = document.getElementsByName("itemId")

var ids = null

for(var i=0i<nodes.lengthi++){

nodes[i].checked=true

if(nodes[i].checked){

if(ids == null){

ids = nodes[i].value

}else{

ids = ids + ","+ nodes[i].value

}

}

//调用删除方法

c_warn_configInfoService.deleteWarnConfigInfo(ids,callBackResult)

}

if(ids == null){

alert(message_sl_choose_one_atList)

return

}

}

}

//删除记录后的回调方法

function callBackResult(data){

//可以显示data的信息

parent.queryForm.submit()

}

需要准备的材料分别有:电脑、html编辑器、浏览器。

1、首先,打开html编辑器,新建html文件,例如:index.html,编写基础代码。

2、在index.html中的<script>标签,输入js代码:$('table tr').eq(1).remove()$('table tr').eq(1).remove()。

3、浏览器运行index.html页面,此时发现表格的最后2行都被js删除了。

使用dom操作element.removeChild()可以实现js代码删除页面一段内容。

假设有以下jsp内容:

<body><div>要删除的</div></body>

使用代码删除div标签:

document.body.removeChild(document.body.childNodes[0])。

更多资料参考W3C:

http://www.w3school.com.cn/xmldom/dom_nodes_remove.asp