<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>javascript 判断两个数组中是否存在相同元素</title>
</head>
<body>
<input type="checkbox" name="mucity[]" id="checkbox" value="10" />北京
<input type="checkbox" name="mucity[]" id="checkbox" value="102" />天津
<input type="checkbox" name="mucity[]" id="checkbox" value="34" />广州
<input type="checkbox" name="mucity[]" id="checkbox" value="35" />上海
<input type="checkbox" name="mucity[]" id="checkbox" value="11" />长沙
<input type="checkbox" name="mucity[]" id="checkbox" value="84" />武汉
<input type="checkbox" name="mucity[]" id="checkbox" value="85" />杭州
<input type="checkbox" name="mucity[]" id="checkbox" value="86" />海南
<input type="checkbox" name="mucity[]" id="checkbox" value="36" />深圳
<script>
b("102,34,35,11,84,85");
function b(str)
{
var array = str.split(",");
var al = array.length;
var m = document.getelementsbyname('mucity[]');
var l = m.length;
for ( var i=0; i< l; i++)
{
for( var j=0;j<al;j++)
{
if( m[i].value == array[j])
{
m[i].checked = true;
break;
}
}
}
}
</script>
</body>
</html>
分享到:
相关推荐
对checkbox的处理,包括struts标签的输出及处理
循环动态判断checkbox是否被选中foreach(Control c in Panel1.Controls)
页面加上几个groupbox,里面放一些checkbox。...通过判断checkbox是否勾选,来获取checkbox的值。包括name,caption内容等。该内容不仅适用于checkbox 还可以循环遍历获得edit 来判断edit内容 从而保存想要的数据!
js 实现 两个checkbox互斥问题! 值得下载看看!资源免费,大家分享!!
JQuery 判断checkbox是否选中,checkbox全选,获取checkbox选中值
WPF CheckBox WPF CheckBox多选的应用
吐槽一下,layui的checkbox简直就是一个坑…(不能提交数组) 数据是从后台来的 品种 {foreach $quotation_type as $key=>$val} <input name=quotation_type lay-skin=primary value={$key} title={$val} ...
JS判断是否选中checkbox
CheckBox在cxGrid中的应用
该资源主要应用于layui框架下table表格渲染后判断checkbox多选控件是否可用,当然done下还可以做其他逻辑判定,附上源码,绝对可用。
1、ListView item中加入checkbox后onListItemClick 事件无法触发。 原因:checkbox的优先级高于ListItem于是屏蔽了ListItem的单击事件。 解决方案:设置checkbox的android:focusable="false" 2、选择其中的...
checkbox的应用示例,完整的呀!!
实例如下: var chk_value = [];//定义一个数组 //name是CheckBox的name属性定义的名称 ...以上这篇CheckBox多选取值及判断CheckBox选中是否为空的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希
判断DatagridView里面的CheckBox是否选中,如果选中,启用另一控件。如果取消选中,则不启用。以及全选和反选的代码。
本文主要实现在自定义的ListView布局中加入CheckBox控件,通过判断用户是否选中CheckBox来对ListView的选中项进行相应的操作。通过一个Demo来展示该功能,选中ListView中的某一项,然后点击Button按钮来显示选中了...
当双击这个node的checkbox时,会出现很奇怪的情况: 第一次双击checkbox,checkbox显示的状态会切换两次状态,unchecked-> checked-> unchecked,而AfterCheck事件仅触发一次,在AfterCheck事件中获取到的checkbox...
ExpandAbleListView+checkbox数组方式级联,外层列表可展开收起,内层列表使用checkbox多选框,点击之后可在顶部的gridlayout显示,顶部显示的选中与checkbox选中状态关联,点击顶部选中的item,可取消选中状态,...
js的一些功能,通过js对checkbox的操作,对select标签的操作
checkbox多项选中及取消选中
layui table中的列为checkbox 使layui中table表格中的列单元格显示为单选框checkbox