亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP develops simple voting system administrator function module (3)

115.png

As shown in the picture, there are three options in the click button here: select all, cancel all and delete selected.

Click these buttons to select all items, deselect all items, and delete all selected voting items

First set the name attribute of the <form> form

<form id="frm" name="frm" method="post" action="" style="margin-bottom:3px;"></form>

In The name attribute is also used in <input>.

<input type="checkbox" name="itm"/>

And give each of the following 3 button buttons an onclick event

<input type="button" value="選擇全部" onclick="selectAll()" />
<input type="button" value="取消全部" onclick="cancelAll()" />
<input type="button" value="刪除所選" onclick="del()" />

Use javascript to implement the function module of all click events, A for loop is used here to mark the selection.

Click "Select All" to make all checkboxes checked=true, click "Cancel All" to make all checkboxes checked=false unchecked.

If the check box is not selected, it means that the content ID is not selected. Click "Delete Selected" and the content will not be deleted and a prompt message will be displayed.

You can select a single ID to delete, or you can select all to delete.

<script language="javascript">
  function selectAll()  //選中所有
  {
    node=window.document.frm.itm;
    for(i=0;i<node.length;i++)
    {
      node[i].checked=true;
    }
  }
  function cancelAll() //取消選中所有
  {
    node=frm.itm;
    for(i=0;i<node.length;i++)
    {
      node[i].checked=false;
    }
  }
  function del() //刪除選中的所有
  {
    node=frm.itm;
    id="";
    for(i=0;i<node.length;i++)
    {
      if(node[i].checked)
      {
        if(id=="")
        {
          id=node[i].value
        }
        else
        {
          id=id+","+node[i].value
        }
      }
    }
    if(id=="")
    {
      alert("您沒(méi)有選擇刪除項(xiàng)");
    }
    else
    {
      location.href="?type=del&id="+id
    }
  }
</script>


Continuing Learning
||
<input type="button" value="選擇全部" onclick="selectAll()" /> <input type="button" value="取消全部" onclick="cancelAll()" /> <input type="button" value="刪除所選" onclick="del()" />
submitReset Code