EasyUI初體驗--右鍵彈框

來源:互聯網
上載者:User

    在C/S中可能很容易實現右鍵彈框,但在B/S中直到今天我才搞定,小小得瑟一下。僅僅一個html頁面,匯入相關的Easy-UI類庫就能搞定,Easy-UI類庫      

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>    <title></title>    <link href="css/easyui.css" rel="stylesheet" type="text/css" />    <link href="css/icon.css" rel="stylesheet" type="text/css" />    <link href="css/demo.css" rel="stylesheet" type="text/css" />    <script src="js/jquery.min.js" type="text/javascript"></script>    <script src="js/jquery.easyui.min.js" type="text/javascript"></script></head><body>    <h2>點下右鍵試試</h2>    <div style="margin:20px 0;"></div>        <div id="mm" class="easyui-menu" style="width:120px;">        <div onclick="javascript:alert('new')">建立</div>        <div>            <span>開啟</span>            <div style="width:150px;">                <div><b>Word</b></div>                <div>Excel</div>                <div>PowerPoint</div>                <div>                    <span>M1</span>                    <div style="width:120px;">                        <div>sub1</div>                        <div>sub2</div>                        <div>                            <span>Sub</span>                            <div style="width:80px;">                                <div onclick="javascript:alert('sub21')">sub21</div>                                <div>sub22</div>                                <div>sub23</div>                            </div>                        </div>                        <div>sub3</div>                    </div>                </div>                <div>                    <span>Window Demos</span>                    <div style="width:120px;">                        <div data-options="href:'window.html'">Window</div>                        <div data-options="href:'dialog.html'">Dialog</div>                        <div><a href="http://www.jeasyui.com" target="_blank">EasyUI</a></div>                    </div>                </div>            </div>        </div>        <div data-options="iconCls:'icon-save'">儲存</div>        <div data-options="iconCls:'icon-print',disabled:true">Print</div>        <div class="menu-sep"></div>        <div>退出</div>    </div>    <script>        $(function () {            $(document).bind('contextmenu', function (e) {                e.preventDefault();                $('#mm').menu('show', {                    left: e.pageX,                    top: e.pageY                });            });        });    </script></body></html>

如下:

                                                          

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.