希望获取到页面中所有的checkbox怎么做?
var domList = document.getElementsByTagName(‘input’);
var checkBoxList = [];
var len = domList.length; //缓存到局部变量
while (len--) { //使用while的效率会比for循环更高
if (domList[len].type == ‘checkbox’) {
checkBoxList.push(domList[len]);
}
}
希望获取到页面中所有的checkbox怎么做?的更多相关文章
- 使用JavaScript设置、获取父子页面中的值
一:获取父页面中的值 有二种方法windows.open()和windows.showModalDialog() 1.windos.open(URL,name,reatures,replace) 再父 ...
- javascript 获取父页面中元素对象方法
父页面中: <input type="hidden" id="areaID" value="test1"> <iframe ...
- Jquery获取当前页面中的复选框选中的内容
在使用$.post提交数据时,有一个数据是复选框获取数据,所以在当前页面获取到复选框选中的值并提交到后端卡住了一下,解决方法如下: 这两个input就是复选框的内容: str += "< ...
- 原生js获取到页面上所有的checkbox
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8" ...
- HTML、jsp页面中radio,checkbox,select数据回显功能,默认被选中问题
最近常常遇到各种复选框.单选框.下拉框的默认被选中的问题,开始也是绞尽脑汁的想办法,今天写一篇学习总结的博文来写一下学习总结. 单选框(radio)默认被选中: 一.jstl技术进行回显 <in ...
- Java 爬虫(获取指定页面中所有的邮箱地址)
import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.io.In ...
- jquery怎样获取html页面中的data-xxx
$(this).attr("data-id") // will return the string "123"or .data() (if you use ne ...
- 将页面中所有的checkbox设成单选得
$(function () { var allBox = $(":checkbox"); allBox.click(function () { allBox.removeAttr( ...
- 获取子窗口中使用jQuery.data()设置的参数
http://hyj1254.iteye.com/blog/643035 假设在iframe子窗口中设置了$('#mydata').data('key','hello world'); 那在包含ifr ...
随机推荐
- 两句话帮你彻底记住gdb之eXamining memory
对于刚学习Unix/Linux环境C编程的小朋友们或者写了很多所谓的C代码的老手们(其实很可能是机械程序员或者是伪程序员)来说,要记住gdb的eXaming memory的语法其实是相当不容易的,如果 ...
- brew install nvm
brew install nvm mkdir ~/.nvm nano ~/.bash_profilectrl+x 退出 source ~/.bash_profile echo $NVM_DIR nvm ...
- javascriptDOM对象之scrollTo()方法,滚动到页面指定位置
scrollTo是一个神奇的方法,常用于篇幅过长的页面,制作一个回顶部的按钮,我这里简单的实现以下 当然没有一个过渡的js效果 scrollTo(xpos,ypos) 参数 描述 xpos 必需.要在 ...
- 更改pip源
~/.pip/下新建pip.conf文件:(Windows下载Users/xxx/pip/pip.ini) [global] trusted-host = pypi.douban.com index- ...
- Chapter 2 Open Book——33
My chin raised a fraction. 我的下巴抬起来了一点. 我略微抬起下颚. "No, she did not send me here. I sent myself.&q ...
- Jmeter连接SqlServer数据库进行压力测试
Jmeter连接SqlServer数据库进行压力测试 前提准备:先安装jdbc驱动 驱动下载链接地址:http://pan.baidu.com/s/1bpDpjSr 密码:v6tn 下载解压之后,讲s ...
- Java笔试题目-my
1.BuildString 和 BefferedString 默认初始容量为 16 , 超出就是 16*2 + 2; 可以看源代码得知; 2.ArrayList 默认的构造方法是一个空的Ob ...
- linux 启动 关闭 防火墙
开启防火墙: systemctl start firewalld 关闭防火墙: systemctl stop firewalld
- Knockout js 绑定 radio 时,当绑定整形的时候,绑定不生效
解决方案: 使用checkedValue和checked 组合,如下代码. <div><input type="radio" name="flavorG ...
- com.google.common.collect.Lists#transform使用注意
/** * Returns a list that applies {@code function} to each element of {@code * fromList}. The return ...