跳到主要內容

發表文章

[JS/JQuery] 多檔上傳 ( drap and drop )

[html] <div id=" ('divImg' +did) " title="上傳圖片" class="UploadImg" ondrop="ImgDrop(event,' did "> /*** drap and drop****/       <input id=" ('Img' +did) " name="Img" type="file" title=" ('file' +did) " > <label for=" ('Img' +did) ">點我上傳<em>或拖拉圖片檔案至此</em></span></label> <a class="BtnDel" title="刪除" onclick="DelPic(' did ');"></i>刪除</a> <img id=" ('imgPreview' +did) " style="display: none;" src="" alt="@item.Title"> /***end drap and drop****/ </div> <div id=" ('errFile' +did) " class="MsgError" tabindex="0"><span><i class="icon-error"></i></span></div>                 [js] var filelist = []; //點擊上傳 $(...

[JS/JQ] 捲動卷軸 增加結果 (一直拉捲動,顯示越來越多)

//捲到底次數(像分頁一樣) var sindex; $(function () {       //begin get data from 1.     sindex = 1;     showDetial(sindex);     $(window).scroll(function () {         var $BodyHeight = $(document).height();         var $ViewportHeight = $(window).height();         $ScrollTop = $(this).scrollTop();         if ($BodyHeight == ($ViewportHeight + $ScrollTop)) {             //scroll bar then add search index.             sindex++;             //get data.             showDetial(sindex);         }     });     //avoid click F5 when scrollerbar not in bottom then default run scroll that have same data, so this check user if click buttom that scroll to top.     $(window).keydown(function (e) { ...

[JS] Facebook 登入 & 取FB大頭照

[.js] window.fbAsyncInit = function () {     FB.init({         appId: ' fbid ',         cookie: true,         xfbml: true,         version: 'v2.2'     }); }; (function (d, s, id) {     var js, fjs = d.getElementsByTagName(s)[0];     if (d.getElementById(id)) return;     js = d.createElement(s); js.id = id;     js.src = "//connect.facebook.net/en_US/sdk.js";     fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); function FBLogin() {     FB.login(function (response) {         if (response.status === 'connected') {             //登入成功             UserLogin();         } else if (response.status === 'not_authorized') {                  ...

[HTML] 上傳檔案 drap and drop

[.html]  <div id="divImg">         <input id="Img" name="Img" type="file">                                            <img id="img" style="display:none;" src="" alt="圖片">  </div>               [.js] var files; $("#Img").change(function () {     if (this.files && this.files[0]) {         FilePrepareUpload(this.files[0], this.files);     } }); $('#divImg').on('drop', function (e) {     if (e.originalEvent.dataTransfer) {         if (e.originalEvent.dataTransfer.files.length) {             e.preventDefault();             e.stopPropagation();             FilePrepareUpload(e.originalEvent.dataTransfer.files[...

[HTML] 文字浮水印效果 text watermark css

[.css] .info-mask {     height: 0;       position: absolute;       margin-top:120px;   } .info-opacity {     opacity: 0.8;     color: black; } .info-text {     color: gray;     font-size: 40px;     -webkit-transform: rotate(-5deg);       line-height: 60px;     max-width:1200px;     letter-spacing:3px;     padding-left:0.8em; } [.html]     <div class="info-mask">         <p class="info-text">             WaterMarkText         </p>     </div>    <table class="table table-bordered table-striped table-responsive table-hover" style="position:                 relative;" >        <tbody class="info-opacity" >     ...

[ASP.NET] 上傳圖片加浮水印

Model [.CS]         [HttpPost]         public int WebUplaodFile()         {             var upfile = Request.Files["myFile"]; ;             if (upfile != null)             {                 new ImgService().ImgMarkImg(Server.MapPath("~/Image"), upfile);             }                       return 1;         } Service [.CS]         public void ImgMarkImg(string spath, HttpPostedFileBase myfile)         {             //浮水印檔案路徑             string MarkImgPath = spath + "/imgmark.png";             //暫存檔路徑           ...

[ASP.NET] MVC Get Model Error Message

*Controller [.cs]  public void Edit(EditModel data) {             if (ModelState.IsValid)             {                 //is valid data             }             else             {                 //get error message                 var errors = ModelState.Select(x => x.Value.Errors)                          .Where(y => y.Count > 0)                          .ToList();                           } }