radio
添加:
<input type="radio" name="xxx" value="0"/>是
<input type="radio" name="xxx" value="1" />否
修改:
<input type="radio" name="xxx" <s:if test="xxx==0"> checked="checked"</s:if> value="0"/>是
<input type="radio" name="xxx" <s:if test="xxx==1"> checked="checked"</s:if> value="1" />否
checkbox
<input type="checkbox" name="xxxx" <s:if test="xxxx== true"> checked="checked" </s:if> value="${xxxx}">
$("input[name='xxxx']").change(function() {
checkboxChange($(this));
});
function checkboxChange(ojb){
if ($(ojb).attr("checked") == "checked") {
$(ojb).val(false);
$(ojb).removeAttr("checked");
} else {
$(ojb).val(true);
$(ojb).attr("checked", "checked");
}
}