方法:
<script language="javaScript">
//<!--function confirmDelete(url,msg)
{
if (!url || url == "") return;
if (!msg || msg == "") return;
if (confirm(msg))
{
location.href = url;
}
}
//-->
</script>
使用:
1、
//用拼接字符串的写法:
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<tr>
<td align="center">序号</td>
<td height="40" align="center">真实姓名</td>
<td align="center">手机号码</td>
<td align="center">性别</td>
<td align="center">证件号码</td>
<!--
<td align="center">删除</td>
-->
</tr>
<?php if ($arrMemberList){
$intserial = 0 ;
foreach($arrMemberList as $key => $value){
$intserial = $intserial + 1;
//var_dump($value);
$arrgender[0] ="女";
$arrgender[1] ="男";
$arrgender[2] = "";
//用拼接字符串的写法:
<span style="font-size:18px;"> $str = "<tr>";
$str .= "<td>$intserial</td>";
$str .= "<td><a href='" . base_url() . "team/alterinfo?id=" . $value['userid'] . "'>" . $value['realname']."</a></td>";
$str .= "<td>" . $value['mobile'] . "</td><td>" . $value['gender'] . "</td>";
$str .= "<td>" . $value['idnumber'] . " " . $value['passportnu'] . "</td>";
$str .= "<td><a href='javascript:confirmDelete(\"" . base_url() . "team/deletemember?id=" . $value['userid'] . "\",\"confirm delete?\")'>delete</a></td>";
$str .= "</tr>";
echo $str;</span>
}
}else{echo "<tr><td colspan =\"6\">尚无队员信息。</td></tr>";}?>
</table>
2、正常使用
<TD class=list_cell noWrap align=middle>
<A class=normal href="javascript:confirmDelete('delgroup.asp?gid=14','组一旦删除,数据将无法恢复。您确实要删除此记录吗?');">删除</A>
</TD>
实际应用中
<a href="javascript:confirmDelete("http://www.huarenbeiphp2.com:81/team/deletemember?id=103","确定要删除吗?")">删除</a>