如何实现checkbox选项根据不同条件使其部分可用,部分不可用 大家好,我现在想实现在后台将一些数据显示在界面上,然后用户自己选择需要的选项对其进行操作。我现在的问题是如何实现在界面显示的内容,根据后台传过来的条件,比如后台传过来的标志位如果是FALSE时,在界面上实现该行所有内容变成灰色(该行使用了许多个TD,表示不同的信息,但想遇到标记位时,使该行所有的信息都为灰色,不可选的状态),并且使得该行的checkbox选项不可用,但对于其他标记位为TRUE的行,checkbox是可选的!谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接判断,如果是false,checkbox加一个disabled="disabled"属性,如果是true则无需加那个属性。 请问如何判断呢,我的数据和标记都是从后台传过来的,我写一些代码,大家看看帮我改一下,我刚接触javascript,还很不熟悉。我准备在snmpcards中添加一个标记flag,当值为TRUE时,checkbox可选,当为FALSE时,不可选。请大家帮我看看该咋对checkbox进行判断,谢谢 <logic:notEmpty name="configForm" property="snmpcards"> <%int i=0;%> <logic:iterate id="snmpcard" name="configForm" property="snmpcards"> <% if (i%2==0) out.println("<tr bgcolor=\"F5F7FA\"> "); else out.println("<tr bgcolor=\"E8F2FE\"> "); %> <td width="10%" align="center"> <html:checkbox property="keys" value="<%= "" + i %>" ></html:checkbox> </td> <td width="15%" align="center"> <div class="table-text-normal"><input type="text" name="snmpName" style="WIDTH: 75%" value="<bean:write name="snmpcard" property="deviceName"/>"></div></td> <td width="15%"> <div class="table-text-normal"><bean:write name="snmpcard" property="deviceType"/></div></td> <td width="15%" align="center"> <a href="http://<bean:write name="snmpcard" property="ip"/>" class="link-text" target="_blank"><bean:write name="snmpcard" property="deviceIP"/></a></td> <td width="15%"> <div class="table-text-normal"><bean:write name="snmpcard" property="devicePosition"/></div></td> <td width="15%"> <div class="table-text-normal"><bean:write name="snmpcard" property="deviceTypeEdition"/></div></td> <td width="15%"> <div class="table-text-normal"><bean:write name="snmpcard" property="deviceID"/></div></td> </tr> <% i++; %> </logic:iterate> </logic:notEmpty> 那个VALUE是什么值呢。是不是保存之前是否选中的状态的? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>价格</title><link href="Library/default.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="jquery.js"></script><script language="javascript">$(function(){ $(".Price").click(function(){ $(this).select(); }) $(".Price").bind("keyup",function(){ // alert("1") var c = $(".checkbox:checked") //c.attr("checked",false) // var t = $(".checkbox[checked=true]").parent(); c.prev(".Price").val($(this).val()); }) $(".act").bind("click",function(){ var c = $(this).prev(".checkbox"); c.attr("checked",!c.attr("checked")) })})</script></head><body><table id="price"> <form id="formprice" name="formprice" method="post" action="setShardPrice.asp"> <tr> <td><input type='text' name='Price' class='Price' value = '0' size='5' /> | <input type='checkbox' name='checkbox' class = 'checkbox' /> <input type='button' value='复选' class='act' /></td> <tr> <td><input type='text' name='Price' class='Price' value = '0' size='5' /> | <input type='checkbox' name='checkbox' class = 'checkbox' /> <input type='button' value='复选' class='act' /></td> <tr> <td><input type='text' name='Price' class='Price' value = '0' size='5' /> | <input type='checkbox' name='checkbox' class = 'checkbox' /> <input type='button' value='复选' class='act' /></td> </form></table></body></html>下载jquery.js 在同一目录下,新建HTML页面,复制代码所有被选中的行,都会一起修改<input type='text' name='Price' class='Price' value = '0' size='5' />的值我想这是你事的. 如何在EASYUI DATAGRID中进行查询?从页面文本框获取条件,不是从DATAGRID中获取条件。 谁能给我个旋转木马代码 用js或者jquery写 的 如何用A超级连接打开一个已经有的窗口,而且能传递参数,又控制窗口的大小呢? 正则 如何获取 非xxx字串 文字变色,我的这么怎么变不了色`` 如何在客户端保存table到内存 各位高手来看看我这个定时有什么问题,老是不执行 请教一个远程框架之间数据交互问题 表格与按钮的联动问题。(小女子不胜感激) 绝对高分求教?在线等待。 jquery :contains 的问题 Extjs 的问题
我准备在snmpcards中添加一个标记flag,当值为TRUE时,checkbox可选,当为FALSE时,不可选。请大家帮我看看该咋对checkbox进行判断,谢谢
<logic:notEmpty name="configForm" property="snmpcards">
<%int i=0;%>
<logic:iterate id="snmpcard" name="configForm" property="snmpcards">
<%
if (i%2==0)
out.println("<tr bgcolor=\"F5F7FA\"> ");
else
out.println("<tr bgcolor=\"E8F2FE\"> ");
%>
<td width="10%" align="center">
<html:checkbox property="keys" value="<%= "" + i %>" ></html:checkbox>
</td>
<td width="15%" align="center">
<div class="table-text-normal"><input type="text" name="snmpName" style="WIDTH: 75%" value="<bean:write name="snmpcard" property="deviceName"/>"></div></td>
<td width="15%">
<div class="table-text-normal"><bean:write name="snmpcard" property="deviceType"/></div></td>
<td width="15%" align="center">
<a href="http://<bean:write name="snmpcard" property="ip"/>" class="link-text" target="_blank"><bean:write name="snmpcard" property="deviceIP"/></a></td>
<td width="15%">
<div class="table-text-normal"><bean:write name="snmpcard" property="devicePosition"/></div></td>
<td width="15%">
<div class="table-text-normal"><bean:write name="snmpcard" property="deviceTypeEdition"/></div></td>
<td width="15%">
<div class="table-text-normal"><bean:write name="snmpcard" property="deviceID"/></div></td>
</tr>
<% i++; %>
</logic:iterate>
</logic:notEmpty>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>价格</title>
<link href="Library/default.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="jquery.js"></script>
<script language="javascript">
$(function(){
$(".Price").click(function(){
$(this).select();
})
$(".Price").bind("keyup",function(){
// alert("1")
var c = $(".checkbox:checked")
//c.attr("checked",false)
// var t = $(".checkbox[checked=true]").parent();
c.prev(".Price").val($(this).val());
})
$(".act").bind("click",function(){
var c = $(this).prev(".checkbox");
c.attr("checked",!c.attr("checked"))
})
})
</script>
</head>
<body>
<table id="price">
<form id="formprice" name="formprice" method="post" action="setShardPrice.asp">
<tr>
<td><input type='text' name='Price' class='Price' value = '0' size='5' />
|
<input type='checkbox' name='checkbox' class = 'checkbox' />
<input type='button' value='复选' class='act' /></td>
<tr>
<td><input type='text' name='Price' class='Price' value = '0' size='5' />
|
<input type='checkbox' name='checkbox' class = 'checkbox' />
<input type='button' value='复选' class='act' /></td>
<tr>
<td><input type='text' name='Price' class='Price' value = '0' size='5' />
|
<input type='checkbox' name='checkbox' class = 'checkbox' />
<input type='button' value='复选' class='act' /></td>
</form>
</table>
</body>
</html>
下载jquery.js
在同一目录下,新建HTML页面,复制代码
所有被选中的行,都会一起修改<input type='text' name='Price' class='Price' value = '0' size='5' />的值
我想这是你事的.