1
다음과 같이하고 싶습니다. 사용자가 하나의 라디오 버튼 (잠금, 삭제 또는 비교)을 선택합니다. 테이블의 관련 칼럼 만 보여주고 싶습니다. (각 옵션마다 다른 열이 있음). 테이블은 아약스 야. 모든 셀의 표시 스타일을 변경해야하지만 어떻게해야할지 모르겠다. 여기자바로 셀의 스타일 표시 변경
내가
function ButtonForTbl(value) {
var x=document.getElementById("audithead").rows[0].cells;
if (value == "lock"){
document.getElementById('lock').checked = true;
//something like for(...)lockCell.style.display=''
//something like for(...)deleteCell.style.display='none'
//something like for(...)compareCell.style.display='none'
}
else if(value == "delete"){
document.getElementById('delete').checked = true;
//something like for(...)lockCell.style.display='none'
//something like for(...)deleteCell.style.display=''
//something like for(...)compareCell.style.display='none'
}
else{
document.getElementById('compare').checked = true;
}
}
은 내가 추측 세포의 표시를 변경하려면 그런 일이 필요합니다 :
for (i = 0; i < deleteCell.length; i++)
deleteCell[i].style.display='' = true ;
표 :
을 여기은 예입니다
oCell = oRow.insertCell(-1);
oCell.setAttribute('id','comCell');
oCell.setAttribute('align', 'center');
oCell.innerHTML = "<input type='checkbox' id='com' value='"+ ind + "'name='com[]'>";
oCell = oRow.insertCell(-1);
oCell.setAttribute('id','lockCell');
oCell.setAttribute('align', 'center');
oCell.innerHTML = "<input type='checkbox' id='lock' value='"+ ind + "'name='lock[]'>";
라디오 버튼 :
<input type="radio" value="compare" id="compare" name="choose" onclick="ButtonForTbl(this.value)"/> Compare
<input type="radio" value="delete" id="delete" name="choose" onclick="ButtonForTbl(this.value)"/> Delete
<input type="radio" value="lock" id="lock" name="choose" onclick="ButtonForTbl(this.value)"/> Lock<br/>
테이블 HTML :
<table class="auditable">
<thead id="audithead">
<tr><td></td></tr>
</thead>
<tbody id="auditTblBody">
</tbody>
</table>
편집 : 전체 행이 그런 식이다 :
<tr>
<td align="center" id="lockCell" style="display: none;">
<input type="checkbox" onclick="" name="lock[]" value="1500" id="lock"></td>
<td align="center" id="delCell" style="display: none;">
<input type="checkbox" name="del[]" value="1500"></td>
<td align="center" id="comCell">
<input type="checkbox" onclick="setChecks(this)" name="com[]" value="1500" id="com"></td>
<td width="65px">100% 1/1</td><td width="105px">2011-01-10 17:47:37</td>
</tr>
너무 감사합니다!
당신이 우리에게 전체 행을 표시 할 수 있습니다 자바 스크립트는 같을 것이다? – Nabab
jQuery 나 Prototype과 같은 라이브러리를 사용하면 도움이되는 것처럼 보입니다. 그런 다음 특정 ID 또는 스타일 클래스를 사용하여 표 셀을 생성하고 ID/클래스 값으로 필터링 된 셀을 쉽게 표시하거나 숨길 수 있습니다. – JST
나는 그 질문을 편집했다. 나는 프레임 워크를 사용하지 않는 것을 선호한다. – Ronny