日期:2014-05-20  浏览次数:20787 次

怎么实现 在表中选中一条记录,然后在点删除按钮 ,就可以把选种的记录删除...
如题...
最好给出代码...


------解决方案--------------------
这个好办,点删除的时候把ID传回后台,在后台实现要删除ID的那一例.
给你个例子.
<%@ page contentType= "text/html;charset=gb2312 "%>
<%@ page import= "java.sql.* "%>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 数据操作 </title>
<style type= "text/css ">
.activelabel { border-left:2px solid #ffffff;border-top:2px solid #ffffff;border-right:2px solid #888888;border-bottom:2px none #888888;cursor:hand;color:#4a7bfb}
.mainDataCell {word-break:keep-all;border-top:1px none #000000;border-left:1px none #000000;border-bottom:1px solid #000000;border-right:1px solid #000000;}
.dataRowBlur {background-color:#FFFFCC;color:#000000;}
.dataRowFocus {background-color:#08246b;color:#ffffff}
</style>
<script language= "javascript " type= "text/javascript ">
var selectedID=null;
function focusDataRow(id)// 定位数据行
{
if(selectedID!=null&&id!=( "DATA_ "+selectedID))
{
blurDataRow( "DATA_ "+selectedID);
}
if(document.all.item(id).className== "dataRowBlur ")
{
document.all.item(id).className= "dataRowFocus ";
selectedID=String(id).replace(/^DATA_/, " ");
}
else if(document.all.item(id).className== "dataRowFocus ")
{
blurDataRow(id);
}

}
function blurDataRow(id)
{

document.all.item(id).className= "dataRowBlur ";
selectedID=null;
}


function dis1()
{
document.all.item( "tab1 ").style.display= "block ";
document.all.item( "tab2 ").style.display= "none ";
document.all.item( "tab3 ").style.display= "none ";
document.all.item( "t1 ").className= "activelabel ";
document.all.item( "t2 ").className= " ";
document.all.item( "t3 ").className= " ";

}
function dis2()
{
document.all.item( "tab2 ").style.display= "block ";
document.all.item( "tab1 ").style.display= "none ";
document.all.item( "tab3 ").style.display= "none ";
document.all.item( "t2 ").className= "activelabel ";
document.all.item( "t1 ").className= " ";
document.all.item( "t3 ").className= " ";

}
function dis3()
{
document.all.item( "tab3 ").style.display= "block ";
document.all.item( "tab1 ").style.display= "none ";
document.all.item( "tab2 ").style.display= "none ";
document.all.item( "t3 ").className= "activelabel ";
document.all.item( "t1 ").className= " ";
document.all.item( "t2 ").className= " ";

}

function cl()//窗口关闭
{
window.close();
}


function up()//修改选中字段的相应值
{
if (selectedID!=null)
{
var job_desc=document.all.item( "job_desc_ "+selectedID).innerHTML;
var min_lvl=document.all.item( "min_lvl_ "+selectedID).innerHTML;
var max_lvl=document.all.item( "max_lvl_ "+selectedID).innerHTML;
window.showModalDialog( "upd.jsp?job_id= "+selectedID+ "&job_desc= "+job_desc+ "&max_lvl= "+max_lvl+ "&min_lvl= "+min_lvl,window, "dialogWidth:500px;dialogHeight:300px;help=no;status=no; ");