javascrip全选效果之学习笔记
我要做的效果就是当我们打开页面时就自动把所有checkbox选中,原理是:先获取所有type为\'input \'的元素,然后各全选的那个选项添加点击事件。如果全选项被经被选中,则通过循环使得每个元素的\'checked\'属性变为true,否则变成false.
document.getElementById(' ')是某个元素的id特性来获取某个指定的元素,返回的是一个对象。document.getElementById(' ') 是根据控件TAG(type属性)获取这个控件对象,返回的是一个对象数组;
要实现一个全选的效果,得先定义一组选项。
代码如下 | 复制代码 |
全选 |
接下利用Javascript来实现效果。教程中的效果是只能点全选时全部选中,如果再点全选就不能全部反选,这里我通过自己的理解,加入了这个功能
代码如下 | 复制代码 |
个人感觉此种方法还是有所欠缺,他会将页面中所有的类型为input的选中.现在我们写了一个利用点击事件来进行全选也反选效果。
代码如下 | 复制代码 |
|
这样如果结合php程序也实现删除功能我们只需要把获取的字符串以post或get方式提供就可以了,下面来看get方式提供。
代码如下 | 复制代码 |
//批量删除 |
在php程序中我们就要以
代码如下 | 复制代码 |
$a = $_GET['id']; |
然后利用where id in( $a ) 即可实现删除了哦,这也算是一简单php教程吧,有需要的朋友可学习交流。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver CS6
Visual web development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software