<logic:present name="allpurview" scope="request">
<logic:iterate id="purview" name="allpurview" scope="request">
${purview.purviewname}<html:checkbox property="purview" value="${purview.id}"></html:checkbox>
</logic:iterate>
</logic:present>以上是输出所有的。 现在想要的效果是,若 ${adminpower.purview}的值比如是1,跟其中某个checkbox相同,则checkbox选中。怎么写!
<logic:iterate id="purview" name="allpurview" scope="request">
${purview.purviewname}<html:checkbox property="purview" value="${purview.id}"></html:checkbox>
</logic:iterate>
</logic:present>以上是输出所有的。 现在想要的效果是,若 ${adminpower.purview}的值比如是1,跟其中某个checkbox相同,则checkbox选中。怎么写!
<c:when test=”${adminpower.purview=1}”>
<input type="checkbox" name="..." value="..." checked></input>选中
</c:when>
<c:otherwise>
<input type="checkbox" name="..." value="..." ></input>不选中
</c:otherwise>
</c:choose>以上代码只是示例,不一定能直接拿来用,就类似Java的if...else...
Struts标签用的不是很多,不太熟悉,应该也有类似应用
function chkAll_onclick(){
if(typeof(adform.city) == "object"){
if(adform.Allcity.checked){
SelAll();
}
else{
unSelAll();
}
}
}
function SelAll(){
var intCount;
var result="";
if(adform.all("city").length > 1)
{
for(intCount = 0; intCount < adform.all("city").length; intCount++)
{
adform.city(intCount).checked = true;
result=result+adform.city(intCount).value+";";
}
}
else{
adform.city.checked = true;
}
alert("你选中的是:"+result);
}function unSelAll(){
var intCount;
if(adform.all("city").length > 1)
{
for(intCount = 0; intCount < adform.all("city").length; intCount++)
{
adform.city(intCount).checked = false;
}
}
else{
adform.city.checked = false;
}
}
</script><td width="97">
<span class="STYLE10"> <input type="checkbox"
name="Allcity" value="checkbox" onClick="chkAll_onclick()">
全国 </span>
</td>
<td width="133">
<span class="STYLE10"> <input type="checkbox"
name="city" value="北京市"> 北京市 </span>
</td>