0

テーブルを折りたたむスクリプトを思いついた

<script type="text/javascript">
var rowVisible = true;
function toggleDisplay(tbl) {
   var tblRows = tbl.rows;
   for (i = 0; i < tblRows.length; i++) {
      if (tblRows[i].className != "headerRow") {
         tblRows[i].style.display = (rowVisible) ? "none" : "";
      }
   }
   rowVisible = !rowVisible;
}
</script>   


<div class="datagrid"><table id="thread_1">
<thead><tr class="headerRow">     

      <th WIDTH="100"><a href="#" onclick="toggleDisplay(document.getElementById('thread_1'))" STYLE="color: white">SLO</a></th>

それはうまくいきますが、私の問題は、人がウェブサイトを離れたときに状態を保存したいということです。最も簡単な方法はクッキーを使用することだと思います。私は前にこのようなことをしたことがありません。どうやってやるの?

4

1 に答える 1