剛剛發現<colgroup>
標記。試圖使用它來切換列。適用於背景顏色等東西,但不能隱藏。切換表格列與<colgroup>
http://www.w3schools.com/tags/tag_colgroup.asp
表列的顯示屬性太多,所以我在想,是的,太棒了!
http://www.w3schools.com/cssref/pr_class_display.asp
似乎並沒有那麼簡單,雖然。線程和討論傾向於深入高級jQuery。爲什麼是這樣?
我的表是這樣:
<table style="vertical-align: middle;">
<colgroup>
<col id="c1">
<col id="c2">
<col id="c3">
<col id="c4">
<col id="c5">
</colgroup>
<tr id="d1">
<td style="text-align: right; vertical-align: middle;">1/2 D note:</td>
等
隨着切換按鈕:
<a href="javascript:toggleCol2();"><img src="/ico/ms.gif" class="ico" alt="X" title="toggle milli-seconds" id="col_ms">milli-seconds</a>
而且這個JavaScript:
var Col2 = 1;
function toggleCol2() {
if (Col2 == 0) {
window.document.getElementById('c2').style.display = "table-column";
window.document.getElementById('col_ms').style.opacity = "1";
Col2 = 1;
} else if (Col2 == 1) {
window.document.getElementById('c2').style.display = "none";
window.document.getElementById('col_ms').style.opacity = "0.2";
Col2 = 0;
}
}
從這個文件:http://flamencopeko.net/bpm_calc.js
這是測試頁面:http://flamencopeko.net/bpm_calc_col.php您需要的山坳標籤的visibility屬性
'col'是煩人限制性的。 http://quirksmode.org/css/css2/columns.html請參閱限制部分。 –
所以看起來。那麼至少我不必在這一件事上感到額外的愚蠢。謝謝。 –