自製的類似EasyUI的JQuery Button外掛程式

來源:互聯網
上載者:User

標籤:

jQuery控制項所需圖片

btn_corner.jpg

btn_corner_hover.jpg

ok.png

reload.png

undo.png

jQuery控制項樣式
.btn_container{ height:25px; font-size:12px; font-family:Arial; color:#444; text-decoration:none; display: block; float:left; margin-right:5px;}.btn_left{ width:10px; height:25px; float:left; background:url(../images/btn_corner.jpg) left top;}.btn_center{ height:25px; float:left; background:url(../images/btn_corner.jpg) -10px 0px; padding:0px 3px; vertical-align:middle; line-height:25px;}.btn_right{ width:10px; height:25px; float:left;background:url(../images/btn_corner.jpg) right top;}.btn_container:hover .btn_left{background:url(../images/btn_corner_hover.jpg) left top;}.btn_container:hover .btn_center{background:url(../images/btn_corner_hover.jpg) -10px 0px;}.btn_container:hover .btn_right{background:url(../images/btn_corner_hover.jpg) right top;}.icon_reload{ width:16px; height:16px; background:url(../images/reload.png); float:left; margin:3px 2px;}.icon_ok{width:16px; height:16px; background:url(../images/ok.png); float:left; margin:3px 2px;}.icon_undo{width:16px; height:16px; background:url(../images/undo.png); float:left; margin:3px 2px;}
jQuery控制項js源碼
$(function () {    $(‘.linkbotton‘).each(function () {        var btnId = $(this).attr(‘id‘);        var btnValue = $(this).attr(‘value‘);        var iconCls = $(this).attr(‘iconCls‘);        var strBtn = "";        if (typeof iconCls == ‘string‘) {            strBtn = "<a href=‘#‘ class=‘btn_container‘ id=‘" + btnId + "‘>"                                            + "<span class=‘btn_left‘></span>"                                            + "<span class=‘btn_center‘>"                                            + "<span class=‘" + iconCls + "‘></span>"                                            + btnValue                                            + "</span>"                                            + "<span class=‘btn_right‘></span>"                                            + "</a>";        } else {            strBtn = "<a href=‘#‘ class=‘btn_container‘ id=‘" + btnId + "‘>"                                            + "<span class=‘btn_left‘></span>"                                            + "<span class=‘btn_center‘>" + btnValue + "</span>"                                            + "<span class=‘btn_right‘></span>"                                            + "</a>";        }        $(this).replaceWith(strBtn);    });});
Demo頁面
<!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/btn.css" rel="stylesheet" type="text/css" />    <script src="../../jquery-1.7.1.min.js" type="text/javascript"></script>    <script src="js/btn.js" type="text/javascript"></script></head><body>    <input id="Button3" type="button" value="Confirm" class=‘linkbotton‘ iconCls=‘icon_ok‘ />    <input id="Button1" type="button" value="button" class=‘linkbotton‘ />    <input id="Button2" type="button" value="Confirm" class=‘linkbotton‘ iconCls=‘icon_reload‘ />        <input id="Button4" type="button" value="Confirm" class=‘linkbotton‘ iconCls=‘icon_undo‘ />    </body></html>

源碼下載

 jQueryButtonPlugin.rar

自製的類似EasyUI的JQuery Button外掛程式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.