日期:2014-05-17  浏览次数:20822 次

不知道还有没有人在啊 我又有问题了
<%
bm_id=request( "bm_id ")
%>
<%       set   rsdan=server.createobject( "adodb.recordset ")
      sql= "select   BM_Person.*,bm_yuangong.Person_xingming   from   BM_Person,bm_yuangong   where   BM_Person.person_id=bm_yuangong.person_id   and   bm_id   in   ( "&BM_id& ") "
      rsdan.open   sql,conn,3,1
      if   rsdan.eof   then  
      set   rscyc=server.createobject( "adodb.recordset ")
      sql= "delete   from   BM   where     BM_id   in   ( "&BM_id& ") "
      rscyc.open   sql,conn,3,1
    response.redirect   "Departmentmanage.asp "
      else
          tmp= " "
for   i=0   to   rsdan.recordcount-1
    tmp=   tmp   &   rsdan( "Person_xingming ")   & ", "
    rsdan.movenext
  next
      %>
      <script   language= "JavaScript ">
alert( "此部门里存在员工 ' <%=tmp%> '不能删除!\n清除部门里的人员进行此操作! ");
history.go(-1);
</script>
    <%  
    end   if        
%>
这段代码的js   怎么   在列表页   提示阿
现在的效果是   弹出提示的时候   页面上是一片空白,如何处理比较好   谢谢

------解决方案--------------------
一下代码看看

<%
Dim bolFlag

bm_id=request( "bm_id ")

set rsdan=server.createobject( "adodb.recordset ")
sql= "select BM_Person.*,bm_yuangong.Person_xingming from BM_Person,bm_yuangong where BM_Person.person_id=bm_yuangong.person_id and bm_id in ( "&BM_id& ") "
rsdan.open sql,conn,3,1
if rsdan.eof then
set rscyc=server.createobject( "adodb.recordset ")
sql= "delete from BM where BM_id in ( "&BM_id& ") "
rscyc.open sql,conn,3,1
response.redirect "Departmentmanage.asp "
else
tmp= " "
for i=0 to rsdan.recordcount-1
tmp= tmp & rsdan( "Person_xingming ") & ", "
rsdan.movenext
next
bolFlag = 1
end if

If bolFlag = 1 Then
%>
<script language= "JavaScript ">
alert( "此部门里存在员工 ' <%=tmp%> '不能删除!\n清除部门里的人员进行此操作! ");
history.go(-1);
</script>
<%
End if
%>

------解决方案--------------------
我觉得xie_yanke(谢烟客)说的有道理,在显示部门列表的时候,作如下判断:如果部门下面有人员的话,就把checkbox设成不能用,即 <input type= "checkbox " name= "BM_id " value= " <%=rscyc( "BM_id ")%> " disabled> ,如果部门下面没有人员才允许选择进行删除

------解决方案--------------------
修改成如下形式,你自己加到代码中

<script language= "JavaScript " type= "text/javascript ">
<!--
function del_cyc()
{
var sForm = document.xoYuStudioH;
var num = 0;
if(typeof(sForm.BM_id.length)== "undefined ")
{
if (sForm.BM_id.checked==false)
{
alert( '请至少选择一个部门! ');
return false;
}
else