0
我想用這個來隱藏/擴展列:
http://www.fiendish.demon.co.uk/html/javascript/hidetablecols.html
但刪除eveything與窗體有關。 Java腳本函數必須相應地改變,但我沒有任何運氣。有什麼建議麼?
謝謝。修改javascript以無窗體工作?
我想用這個來隱藏/擴展列:
http://www.fiendish.demon.co.uk/html/javascript/hidetablecols.html
但刪除eveything與窗體有關。 Java腳本函數必須相應地改變,但我沒有任何運氣。有什麼建議麼?
謝謝。修改javascript以無窗體工作?
代碼測試和工作。隨意問關於它的問題:)
<script language="javascript">
// Set the default "show" mode to that specified by W3C DOM
// compliant browsers
var showMode = 'table-cell';
// However, IE5 at least does not render table cells correctly
// using the style 'table-cell', but does when the style 'block'
// is used, so handle this
if (document.all) showMode='block';
// This is the function that actually does the manipulation
var States = { };
function toggleVis(col){
if (!States[col] || States[col].IsOpen == null)
{
States[col] = {isOpen : true}; // This assumes the cell is already shown
}
mode = States[col].IsOpen ? showMode : 'none';
cells = document.getElementsByName(col);
for(j = 0; j < cells.length; j++) cells[j].style.display = mode;
States[col].IsOpen = !States[col].IsOpen;
}
</script>
<a href="#" onclick="toggleVis('tcol1'); return false;">Toggle 1</a>
<a href="#" onclick="toggleVis('tcol2'); return false;">Toggle 2</a>
<a href="#" onclick="toggleVis('tcol3'); return false;">Toggle 3</a>
<a href="#" onclick="toggleVis('tcol4'); return false;">Toggle 3</a>
<table border=1>
<tr>
<td name="tcol1" class="bold">column 1 text</td>
<td name="tcol2" >column 2 text</td>
<td name="tcol3" class="italic">column 3 text</td>
<td name="tcol4" >column 4 text</td>
</tr>
<tr>
<td name="tcol1" class="bold">column 1 text</td>
<td name="tcol2" >column 2 text</td>
<td name="tcol3" class="italic">column 3 text</td>
<td name="tcol4" >column 4 text</td>
</tr>
</table>
你是什麼意思的'形式'?複選框?你會如何切換欄? – 2009-01-23 00:27:17