Sie sind auf Seite 1von 3

Output window

These are the Javascript I have used for the above: Script in 2nd HTML item: <a href="javascript:hideColumn(1)">Product line</a> Script in 2nd HTML item: <a href="javascript:hideColumn(2)">Product type</a> Script in 3rd HTML item: <a href="javascript:hideColumn(3)">Quantity</a>

Before product line: <span id="list"></span>

Last HTML item: <script> function hideColumn(colNum) { var listHeader = document.getElementById("market"); var table = listHeader.parentNode.parentNode.parentNode.parentNode; var rows = table.getElementsByTagName("tr"); for(var i=0;i<rows.length;i++) { var cells = rows[i].getElementsByTagName("td"); if(cells[colNum-1].style.display == 'none') { cells[colNum-1].style.display = ''; } else { cells[colNum-1].style.display = 'none'; } } } </script>

Das könnte Ihnen auch gefallen