struts 中的html:radio的问题

hhycarot 2004-06-11 10:35:16
我想使“radio1”的那个radio被选中的时候,他下面的两个radio才能被使用;而如果“radio1”不被选中的时候,他下面的那两个radio不能使用,或者用户看不见也可以。
但是html:radio好像没有disabled属性,应该怎么做呢?
.....
<tr >
<td>
<html:radio property="radio1" value="1"/>radio1
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>
<html:radio property="radio2" value="2" />radio2
</td>
<td>
<html:select property="spm" >
<html:option value="1">1</html:option>
<html:option value="2">2</html:option>
</html:select>
</td>
</tr>
<tr>
<td>
<html:radio property="radio2" value="3" />radio3
</td>
<td> </td>
<td> </td>
</tr>
...
...全文
75 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
kui 2004-06-14
  • 打赏
  • 举报
回复
看一下下面的例子:


<%@ page contentType="text/html;charset=GB2312" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>

<html:html >
<head>
<title>
</title>
<META http-equiv=Content-Type content="text/html; charset=gb2312">

</head>
<body bgColor=white onLoad=Load()>
<html:base /> <html:form method="post"
action="/HelloWordAction.do">
<html:text property="mybeanvariable1" />
<p>
</p>
<script language="javascript">
function Load()
{

document.forms[0].elements[2].disabled=1;
document.forms[0].elements[3].disabled=1;

}
</script>
<input type="checkbox" name="check1" value="第一项" onClick={document.forms[0].elements[2].disabled=!document.forms[0].elements[2].disabled;document.forms[0].elements[3].disabled=!document.forms[0].elements[3].disabled}> 第一项
<html:checkbox value="第二项" property="check2" /> 第二项
<html:checkbox value="第三项" property="check3" /> 第三项
<p>
</p>
<html:submit value="提交" /> <html:reset value="重写" />
</html:form >
</body>
</html:html >

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧