哪里,我个我有做过,用smarttemplate模板做的循环!也是生成checkbox,呵呵!

解决方案 »

  1.   

    偶也贴一个自己常用的~~function delRecord()
    {
    var flag=true;
    var temp="";
    var tmp;
    if((document.theForm.id_list.length+"")=="undefined")
    {
    tmp = 1
    }else{
    tmp = document.theForm.id_list.length
    }
    if (tmp==1){
    if (document.theForm.id_list.checked)
    {
       flag=false;
       temp=document.theForm.id_list.value
    }
    }else{
    for (i=0;i<document.theForm.id_list.length;i++)
    {
    if (document.theForm.id_list[i].checked)
    {
    if (temp=="")
    {
    flag=false;
    temp=document.theForm.id_list[i].value
    }else{
    flag=false;
    temp = temp +","+ document.theForm.id_list[i].value
    }
    }
    }
      }
       
    if (flag)
    {
    alert("对不起,你还没有选择!");
    }else{
       if (confirm("删除后不可恢复,确定吗?"))
       {
       window.location="?action=del&id="+temp;
       return false;
        }else{
        return false;
        }
    }
    return !flag;
    }
      

  2.   

    html:message_list.html
    <table border=1 width="100%"  cellspacing="0" cellpadding="1" bordercolordark=#EFEFEF bordercolor="#FFFFFF"  style="font-size:12px;">
      {section name=t loop=$message} {strip} 
      <tr bgcolor="#FAFAFA"  onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#FFFFFF'">
        <td width="5%" height="20" align="center" valign=middle style="BORDER-LEFT-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-TOP-STYLE:none;border-bottom-color: #C0C0C0;"><input type=checkbox name="chk[]" id="chkItem" value={$message[t].message_id}>
          </td>
          <td width="15%" align="left" style="BORDER-LEFT-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-TOP-STYLE:none;border-bottom-color: #C0C0C0;">{$message[t].user_id}</td>
        <td width="45%" align="left" style="BORDER-LEFT-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-TOP-STYLE:none;border-bottom-color: #C0C0C0;"><a  href="./index.php?act=Message&CODE=00&message_id={$message[t].message_id}&sign=read" >{$message[t].sign1}{$message[t].title}{$message[t].sign2}</a></td>
        <td width="25%" align="left" style="BORDER-LEFT-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-TOP-STYLE:none;border-bottom-color: #C0C0C0;" >{$message[t].record_date}</td>
       <td width="15%" style="BORDER-LEFT-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-TOP-STYLE:none;border-bottom-color: #C0C0C0;"><a  href="./index.php?act=Message&CODE=05&message_id={$message[t].message_id}" >回复</a></td>
    </tr>
        {/strip} {/section}<p>
     <tr bordercolor="E5E5E5" bgcolor="#FFFFFF">
       <td width="30%" height="22" align="left" colspan="2" style="BORDER-LEFT-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-TOP-STYLE:none;border-bottom-color: #C0C0C0;"><a href="#" onmousemove ="window.status='';" onclick="check('1')">全选</a>&nbsp;-<a href="#"  onmousemove ="window.status='';" onclick="check('0')">取消</a></td>
       <td width="70%" align="right" colspan="5" style="BORDER-LEFT-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-TOP-STYLE:none;border-bottom-color: #C0C0C0;">{$Frist}{$Previous}{$Next}{$Last}{$Jump}</td>
     </tr>
    </table>
    <table width="100%"  cellspacing="0" cellpadding="0" style="font-size:12px;">
     <tr bordercolor="E5E5E5" bgcolor="E5E5E5">
       <td width="60%" align="left" colspan="3"><input type="submit" value="删除"></td>
       <td width="40%" align="right" colspan="2">{$Total}&nbsp条信息中的&nbsp{$FR}-{$LA}</td>
     </tr>
    </table>
    php:
    function message_delete()
        {
    global $gTPL,$gDB,$gINFO;
    $coun = count ($_POST['chk']);
    $tmp=$_POST['chk'];
      for ($i = 0; $i < $coun; $i++)
    {
          //删除操作
          $query_str = "DELETE FROM message WHERE message_id =$tmp[$i]";
    $gDB->query($query_str);
    }
      $this->message_list();
        }