Re: [問題] 動態表格(可隱藏/顯示)

看板Web_Design作者 (沉默是金。)時間15年前 (2010/04/12 18:32), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串3/3 (看更多)
: : 如果想要設計一個簡單的表格 : : ┌────┬──┬──┬──┬──┬─┐ : : │ NAME │-B │-C │-D │-E │-F│ : : ├────┼──┼──┼──┼──┼─┤ : : ├────┼──┼──┼──┼──┼─┤ : : ├────┼──┼──┼──┼──┼─┤ : : ├────┼──┼──┼──┼──┼─┤ : : ├────┼──┼──┼──┼──┼─┤ : : └────┴──┴──┴──┴──┴─┘ : : 然後我按- 那一欄就消失 + 按了可以再打開 : : 這樣應該用甚麼code實現? (js?) 或是可以提供關鍵字 我慢慢找 : : 感謝 btw 隱藏直的cols 其實不難 $(".clickme").click(function(){ $(this).toggleClass("add"); var ind=$("table.dataTable tr:eq(0) td").index(this); var hide=$(this).is(".add"); $(".show",this).html((hide?"+":"-")); $("table.dataTable tr:gt(0)").each( function(){ if(hide) $("td",this).eq(ind).hide(); else $("td",this).eq(ind).show(); } ); }); http://tonyq.org/test/testHideTableCol.html --  ▄▅▆▇███▇▆▅▄▃        ╰┼╯─╮ ╮         ◥███████████◣       ╰┼╯=│=│         ◥██████───────    *. ╯  ╯ ╯ の 物 語 .*  ◥███████──────◣ ~ ◢◣             ◢◣  ◥██████───────◤   ◥◤  空白的世界.翼 ◥◤  ◥██▁▂▃▄▅▆▇███▆▅▄▃▂▂telnet://tony1223.twbbs.org -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.133.218.161 ※ 編輯: TonyQ 來自: 220.133.218.161 (04/12 18:33) ※ 編輯: TonyQ 來自: 220.133.218.161 (04/12 20:56) ※ 編輯: TonyQ 來自: 220.133.218.161 (04/12 20:56)

04/13 00:08, , 1F
3Q
04/13 00:08, 1F
文章代碼(AID): #1BmlR3wz (Web_Design)
文章代碼(AID): #1BmlR3wz (Web_Design)