批量上傳圖片

來源:互聯網
上載者:User

標籤:

實現的

引用

<script src="/common/jquery-1.9.1.min.js" type="text/javascript"></script><script type="text/javascript" src="/kindeditor-4.1.7/kindeditor-all.js"></script>
<style type="text/css">        #imageView{background:#F5F9FF;padding:5px;}  #imageView ul li{margin:2px;float:left;width:100px;height:100px;position:relative;border: 1px solid #d5e4fa;}  #imageView ul li img{width:100px;height:100px;border:0;}  #imageView ul li span{position:absolute;right:5px;top:5px;height:14px;width:14px;background:url(../images/false.gif) no-repeat;display:none;}      </style>

htm頁面

<table class="tableConfig" cellpadding="0" cellspacing="1">   <tr>      <td class="leftcss" width="100">產品圖片:</td>      <td colspan="3">           <div id="imageView" class="clearfix" runat="server"><ul></ul></div>           <input type="button" id="upimage" value="批量上傳" class="button1" />           <label><input type="checkbox" id="isClear" checked="checked" />保留已上傳的</label>       </td>   </tr>   <tr>       <td class="leftcss">詳細資料:</td>       <td colspan="3">
<textarea name="txtContent" id="txtContent" style="width: 100%; height: 300px;" runat="server"></textarea> </td> </tr> </table>

js部分

 <script type="text/javascript">              function BindImageList() {            $("#imageView ul li").mouseenter(function () {                $(this).find("span").show();            }).mouseleave(function () {                $(this).find("span").hide();            });            $("#imageView ul li span").click(function () {                if (confirm("確定要刪除此圖片")) {                    $(this).parent().remove();                }            });        }        var editor;        $(function () {            BindImageList();            //載入編輯器樣式            editor = KindEditor.create(‘textarea[name="txtContent"]‘, {                allowFileManager: false,                afterCreate: function () {                    var self = this;                }            });            //圖片上傳            $(‘#upimage‘).click(function () {                editor.loadPlugin(‘multiimage‘, function () {                    editor.plugin.multiImageDialog({                        clickFn: function (urlList) {                            var _html = [];                            KindEditor.each(urlList, function (i, data) {                                _html.push(‘<li><img src="‘ + data.url + ‘" /><span title="刪除"></span><input type="hidden" value="‘ + data.url + ‘" name="pics" /></li>‘);                            });                            if ($("#isClear").attr("checked") != "checked")                                $(‘#imageView ul‘).empty();                            $("#imageView ul").append(_html.join(‘‘));                            BindImageList();                            editor.hideDialog();                        }                    });                });            });        })    </script>

 

批量上傳圖片

聯繫我們

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