<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>EasyUI 測試</title> <link rel="stylesheet" type="text/css" href="../jquery/easyui-themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../jquery/easyui-themes/icon.css"> <script type="text/javascript" src="../jquery/jquery.js"></script> <script type="text/javascript" src="../jquery/jquery.easyui.min.js"></script> <script type="text/javascript" src="../jquery/easyui-lang-zh_TW.js"></script> </head> <body> <a href="#" class="easyui-linkbutton" id="select_all">全部展開</a> <a href="#" class="easyui-linkbutton" id="unselect_all">全部縮合</a><br><br> <div id="acc1"> <div title="標題 1" style="padding:10px;">內容 1</div> <div title="標題 2" style="padding:10px;">內容 2</div> <div title="標題 3" style="padding:10px;">內容 3</div> </div> <script language="javascript"> $(document).ready(function(){ $("#acc1").accordion({ width:300, multiple:true }); $("#select_all").bind("click",function(){ var p=$("#acc1").accordion("panels"); for (var i=0; i<p.length; i++) { var id=$("#acc1").accordion("getPanelIndex",p[i]); $("#acc1").accordion("select",id) } }); $("#unselect_all").bind("click",function(){ var p=$("#acc1").accordion("panels"); for (var i=0; i<p.length; i++) { var id=$("#acc1").accordion("getPanelIndex",p[i]); $("#acc1").accordion("unselect",id) } }); }); </script> </body> </html>