使用checkbox做出radiobutton的效果
首先分别使用不同name的checkbox放在同一个tr的两个td内。并为他们设置onclick事件来改变点击后状态。
php:
str[info]="<table align='center' class='hovertable'>
<tr> <th >权限</th><th >允许</th><th >拒绝</th></tr>
<tr align='center' onmouseover='this.style.backgroundColor=#ffff66;' onmouseout='this.style.backgroundColor=#d4e3e5;'>
<td>{$perm['add']}用户</td>
<td><label><input type='checkbox' name='box' value='padd' $paddcheck onclick='changeallow(this);'></label></td>
<td><label><input type='checkbox' name='boxr' value='padd' $paddruse onclick='changerefuse(this);'></label></td>
</tr>
<tr align='center' onmouseover='this.style.backgroundColor='#ffff66';' onmouseout='this.style.backgroundColor='#d4e3e5';'>
<td>{$perm['update']}用户信息</td>
<td><label><input type='checkbox' name='box' value='pupdate' $pupdatecheck onclick='changeallow(this);'></label></td>
<td><label><input type='checkbox' name='boxr' value='pupdate' $pupdateruse onclick='changerefuse(this);'></label></td>
</tr>
<tr align='center' onmouseover='this.style.backgroundColor='#ffff66';' onmouseout='this.style.backgroundColor='#d4e3e5';'>
<td>{$perm['del']}用户</td>
<td><label><input type='checkbox' name='box' value='pdelect' $pdelectcheck onclick='changeallow(this);'></label></td>
<td><label><input type='checkbox' name='boxr' value='pdelect' $pdelectruse onclick='changerefuse(this);'></label></td> </tr>
<tr align='center' onmouseover='this.style.backgroundColor='#ffff66';' onmouseout='this.style.backgroundColor='#d4e3e5';'>
<td>{$menu['main_pay_manage']}</td>
<td><label><input type='checkbox' name='box' value='pbillmg' $pbillmgcheck onclick='changeallow(this);'></label></td>
<td><label><input type='checkbox' name='boxr' value='pbillmg' $pbillmgruse onclick='changerefuse(this);'></label></td>
</tr>
<tr align='center' onmouseover='this.style.backgroundColor='#ffff66';' onmouseout='this.style.backgroundColor='#d4e3e5';'>
<td>{$menu['main_electrovalence_set']}</td>
<td><label><input type='checkbox' name='box' value='ppriceset' $ppricesetcheck nclick='changeallow(this);'></label></td>
<td><label><input type='checkbox' name='boxr' value='ppriceset' $ppricesetruse click='changerefuse(this);'></label></td>
</tr>
</table>";
js:
function changeallow(obj) {
var tarchoose=document.getElementsByName("box");
var tarrefuse = document.getElementsByName("boxr");
for(var i=0;i<tarchoose.length;i++)
{
if(tarchoose[i].checked==true)
{
tarrefuse[i].checked=false;
}else{tarrefuse[i].checked=true;}
}
}
function changerefuse(obj) {
var tarchoose=document.getElementsByName("box");
var tarrefuse = document.getElementsByName("boxr");
for(var i=0;i<tarchoose.length;i++)
{
if(tarrefuse[i].checked==true)
{
tarchoose[i].checked=false;
}else{tarchoose[i].checked=true;}
}
}

使用checkbox做出radiobutton的效果的更多相关文章
- 如何在Android的ListView中构建CheckBox和RadioButton列表(支持单选和多选的投票项目示例)
引言 我们在android的APP开发中有时候会碰到提供一个选项列表供用户选择的需求,如在投票类型的项目中,我们提供一些主题给用户选择,每个主题有若干选项,用户对这些主题的选项进行选择,然后提交. 本 ...
- Android零基础入门第20节:CheckBox和RadioButton使用大全
原文:Android零基础入门第20节:CheckBox和RadioButton使用大全 本期先来学习Button的两个子控件,无论是单选还是复选,在实际开发中都是使用的较多的控件,相信通过本期的学习 ...
- as3如何做出残影效果
在页游中,时不时能看到人物做一些快速移动动作如冲刺时,有残影效果,强化了画面表现.实际人肉眼之所以能看到残影的效果,是因为观察到的物体会在人视线中残留几十毫秒时间,当运动物体运动太快时,人肉眼所见未能 ...
- MVC小系列(十八)【给checkbox和radiobutton添加集合的重载】
mvc对DropDownListFor的重载很多,但对checkbox和radiobutton没有对集合的重载 所以该讲主要针对集合的扩展: #region 复选框扩展 /// <summary ...
- 设置ToggleButton、Switch、CheckBox和RadioButton的显示效果
ToggleButton.Switch.CheckBox和RadioButton都是继承自android.widget.CompoundButton,意思是可选择的,因此它们的用法都很类似.Compo ...
- 教你在浏览器里做出EXCEL的效果
在浏览器里做出EXCEL的效果,复制.粘贴.设置公式.双击编辑等效果,如果自己开发的话,比较麻烦,建议使用成熟的插件.这里介绍使用智表ZCELL插件,实现用户快捷操作. 首先下载插件,引入到页面中,一 ...
- WPF:CheckBox竖向的滑块效果
原文:WPF:CheckBox竖向的滑块效果 之前做了一个横向的滑块效果,<WPF:CheckBox滑块效果>,其实我觉得那个不好看,今天又做了一个竖向的玩. <Style Targ ...
- Jquery中的CheckBox、RadioButton、DropDownList的取值赋值实现代码
随着Jquery的作用越来越大,使用的朋友也越来越多.在Web中,由于CheckBox. Radiobutton . DropDownList等控件使用的频率比较高,就关系到这些控件在Jquery中的 ...
- 零元学Expression Design 4 - Chapter 6 教你如何在5分钟内做出文字立体感效果
原文:零元学Expression Design 4 - Chapter 6 教你如何在5分钟内做出文字立体感效果 又来一篇五分钟做设计啦~ 本篇将教大家如何运用Design内建工具Blend Path ...
随机推荐
- ssh用户登录
1.搭建环境,连数据库,建包建类 2.Admin,这是表,表必须有主码 package com.chao.db; /** * Admin entity. @author MyEclipse Persi ...
- centos下php安装swoole扩展
官网:http://wiki.swoole.com/wiki/index/prid-1 国内Git镜像:http://git.oschina.net/matyhtf/swoole.git 下载源码后, ...
- JAVA06数组之动手动脑问题解决
一.随机生成10个数,填充一个数组,然后用消息框显示数组内容,接着计算数组元素的和,将结果也显示在消息框中. 1.设计思路:首先生成10个随机数,然后存放至长度至少是10的数组中,然后计算10个随机 ...
- Jenkins 命令
Jenkins 服务集群环境的启动命令 #必须在root下启动 sh /home/jenkins/tomcat/bin/startup.sh dubbo服务注册中心 zookeeper启动命令 /we ...
- 常看常遇见之一——BS架构VS CS架构
常看常遇见之一——BS架构VS CS架构 1.BS架构 即Browser/Server(浏览器/服务器)结构,是随着Internet技术的兴起,对C/S结构的一种变化或者改进的结构.在这种结构下,用户 ...
- C语言执行时报错“表达式必须是可修改的左值,无法从“const char [3]”转换为“char [120]” ”,原因:字符串不能直接赋值
解决该问题的方法:使用strcpy函数进行字符串拷贝 原型声明:char *strcpy(char* dest, const char *src); 头文件:#include <string ...
- Adb refused a command 解决方法
原文:How To Fix Android Error Adb Refused A Command 地址:http://downloadfixit.com/android-error-adb-refu ...
- Laravel框架 mysql 数据库 —— 基本使用
增删改查 配置完数据库连接,就可以使用DB类进行查询了. 查询 $results = DB::select('select * from users where id = ?', array(1)); ...
- typeof(self) 的作用
block对于其变量都会形成strong reference,对于self也会形成strong reference ,而如果self本身对block也是 strong reference 的话,就会形 ...
- solution to E: failed to fetch .......
There are some issues today for me that my desktop can't boot as I expected, I installed windows 8.1 ...