var domList = document.getElementsByTagName(‘input’); var checkBoxList = []; var len = domList.length; //缓存到局部变量 while (len--) { //使用while的效率会比for循环更高 if (domList[len].type == ‘checkbox’) { checkBoxList.push(domList[len]); } }…
一:获取父页面中的值 有二种方法windows.open()和windows.showModalDialog() 1.windos.open(URL,name,reatures,replace) 再父页面中 fatherPage.aspx <script type="text/javascript"> function a(){ windows.open("sonPage.aspx") } </script> 在子页面(sonPage.asp…
父页面中: <input type="hidden" id="areaID" value="test1"> <iframe align="center" style="width: 100%; height: 100%;" frameborder="0" scrolling="no" src="Html//test.jsp">…
在使用$.post提交数据时,有一个数据是复选框获取数据,所以在当前页面获取到复选框选中的值并提交到后端卡住了一下,解决方法如下: 这两个input就是复选框的内容: str += "<input type='checkbox' name="+"type[]"+" value='1'>北京"; str += "<input type='checkbox' name="+"type[]"+&…
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" cont…
最近常常遇到各种复选框.单选框.下拉框的默认被选中的问题,开始也是绞尽脑汁的想办法,今天写一篇学习总结的博文来写一下学习总结. 单选框(radio)默认被选中: 一.jstl技术进行回显 <input type="radio" name="sex" <f:if test="${c.sex=='男' }">checked="checked"</f:if> value="男" /&…
import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.io.InputStreamReader;import java.net.URL;import java.util.ArrayList;import java.util.List;import java.util.regex.Matcher;import java.util.regex.Pattern; /*…
$(this).attr("data-id") // will return the string "123"or .data() (if you use newer jQuery >= 1.4.3)$(this).data("id") // will return the number 123注:1.两种方法 ①使用attr方法获得data-*的值 $(this).attr('data-id');② $(this).data("…
$(function () { var allBox = $(":checkbox"); allBox.click(function () { allBox.removeAttr("checked"); $(this).attr("checked", "checked"); }); });     $(function(){ $(':checkbox[name=jcxflIds]').each(function(){ $(th…
http://hyj1254.iteye.com/blog/643035 假设在iframe子窗口中设置了$('#mydata').data('key','hello world'); 那在包含iframe的父页面中如何获取它呢?直接使用$('#mydata').data('key')是不行的.     原因是:data()将数据存入了iframe页面的jQuery对象中,与父页面的jQuery对象无关.父页面中的$即jQuery对象,直接使用它显然无法获取.     解决办法是:设法获取ifr…