Category: Javascript & Jquery & React & Angular

about javascript & jquery

  • jquery Multi file upload preview

    jquery Multi file upload preview

     

    http://www.fyneworks.com/jquery/multifile/#Usage
    http://www.raymondcamden.com/2013/09/10/Adding-a-file-display-list-to-a-multifile-upload-HTML-control
    http://www.formget.com/upload-multiple-images-using-php-and-jquery/
    CAPTCHA php
    http://www.codeproject.com/Articles/26595/CAPTCHA-Image-in-PHP

    https://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html
    http://www.tutorialchip.com/php-upload-class/#tab-download
    http://www.heylove.de/
    http://jindo.dev.naver.com/smarteditor/user_guide/
  • ​Fade, Slide with bullet

    Fade, Slide with bullet

    http://rygine.com/projects/looper.js/docs/#examples-cross-fade
    http://jsfiddle.net/e4STr/1/
    http://www.lambertgroupproductions.com/canyon/full_screen_background/fullscreen_background_bullets_fade_transition.html
  • ​Table Tree

    ​Table Tree

    http://labs.abeautifulsite.net/archived/jquery-fileTree/demo/

    http://www.jqueryrain.com/?TWLUHFmT 사이트맵용

     http://www.jqueryrain.com/?9_I6fGfI
    http://www.jqueryrain.com/demo/jquery-treeview/
    http://ludo.cubicphuse.nl/jquery-treetable/#examples
    https://github.com/RisingStack/react-way-immutable-flux
    http://wwwendt.de/tech/dynatree/doc/samples.html
    http://wwwendt.de/tech/fancytree/demo/#https://github.com/mar10/fancytree/
  • encoding utf-8 vs euc-kr

    jsp1 에서는 utf-8, jsp2 에서는 euc-kr 문자를보내주는데

    utf-8에서 보내주는 한글은 깨지고
    euc-kr에서 보내주는 한글은 정상적으로 받아집니다.
    javascript
    function fncEnCode(param)
    {
    // sjisbmoc
    var encode = ”;
    for(i=0; i<param.length; i++)
    {
    var len = ”+param.charCodeAt(i);
    var token = ” + len.length;
    encode += token + param.charCodeAt(i);
    }
    return encode;
    }
    function fncDeCode(param)
    {
    // sjisbmoc
    var sb = ”;
    var pos = 0;
    var flg = true;
    if(param != null)
    {
    if(param.length>1)
    {
    while(flg)
    {
    var sLen = param.substring(pos,++pos);
    var nLen = 0;
    try
    {
    nLen = parseInt(sLen);
    }
    catch(e)
    {
    nLen = 0;
    }
    var code = ”;
    if((pos+nLen)>param.length)
    code = param.substring(pos);
    else
    code = param.substring(pos,(pos+nLen));
    pos += nLen;
    sb += String.fromCharCode(code);
    if(pos >= param.length)
    flg = false;
    }
    }
    }
    return sb;
    }
    java
    public static String EnCode(String param)
    {
    // sjisbmoc
    StringBuffer sb = new StringBuffer();
    if(param == null)
    {
    sb.append(“”);
    }
    else
    {
    if(param.length()>0)
    {
    for(int i=0; i<param.length(); i++)
    {
    String len = “”+((int)param.charAt(i));
    sb.append(len.length());
    sb.append(((int)param.charAt(i)));
    }
    }
    }
    return sb.toString();
    }
    public static String DeCode(String param)
    {
    // sjisbmoc
    StringBuffer sb = new StringBuffer();
    int pos = 0;
    boolean flg = true;
    if(param!=null)
    {
    if(param.length()>1)
    {
    while(flg)
    {
    String sLen = param.substring(pos,++pos);
    int nLen = 0;
    try
    {
    nLen = Integer.parseInt(sLen);
    }
    catch(Exception e)
    {
    nLen = 0;
    }
    String code = “”;
    if((pos+nLen)>param.length())
    code = param.substring(pos);
    else
    code = param.substring(pos,(pos+nLen));
    pos += nLen;
    sb.append(((char) Integer.parseInt(code)));
    if(pos >= param.length())
    flg = false;
    }
    }
    }
    else
    {
    param = “”;
    }
    return sb.toString();
    }
  • 스마트 에디터 IE10 호환

    스마트 에디터 IE10 호환
    if(this.bIE&navigaor.appVersion.indexOf(“MSIE 9”)<0&&navigator.appVersion.indexOf(“MSIE 10”)<0){button=document.createElement(“<BUTTON type=‘button’>”);)else{button=document.createElement(“BUTTON”);button.type=“button”;}
  • select option add dynamically

    var select = $(‘#myselect’);
    var newOptions = {
    ‘red’ : ‘Red’,
    ‘blue’ : ‘Blue’,
    ‘green’ : ‘Green’,
    ‘yellow’ : ‘Yellow’
    };
    $(‘option’, select).remove();
    $.each(newOptions, function(text, key) {
    var option = new Option(key, text);
    select.append($(option));
    });
  • n 주 후의 해당주 마지막 요일 및 날짜 구하기

    javascript
    n 주 후의  해당주  마지막 요일 및 날짜 구하기
    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
    <html>
     <head>
      <title> New Document </title>
      <meta name=”Generator” content=”EditPlus”>
      <meta name=”Author” content=””>
      <meta name=”Keywords” content=””>
      <meta name=”Description” content=””>
      <script type=”text/javascript”>
      <!–
    function DateFormat(obj) { //날짜를 YYYYMMDD 형식으로 변경하는 함수
                //Year
                var yy = obj.getYear();
                //Month
                if (String(obj.getMonth() + 1).length == 1) {
                    var mm = “0” + (obj.getMonth() + 1);
                }
                else {
                    var mm = obj.getMonth() + 1;
                }
                //Day
                if (String(obj.getDate()).length == 1) {
                    var dd = “0” + obj.getDate();
                }
                else {
                    var dd = obj.getDate();
                }
                var date = String(yy) + “-” + String(mm) + “-” + String(dd);
                return date;
            }
    function LicenceToOccupy(acceptCompletionDate, wk)
    {
    var parts = acceptCompletionDate.split(“-“);
    var date1 = new Date(parts[0], (parts[1] – 1), parseInt(parts[2]) + 7*(wk-1)); //month 0 based, day: parse to int and increment 14 (2 weeks)
    //return date1.toLocaleDateString(); //if the d/m/y format is the local string, otherwise some cusom formatting needs to be done
    return date1;
    }
    var a = LicenceToOccupy(‘2015-10-01’,2);
    var s = DateFormat(a);
    var oss = s.replace(/-/g,”);
    var idate = oss; //기준일
            var intDayCnt1 = 0;
            var intDayCnt2 = 0;
    function get_Date(obj) { //월요일 ~ 일요일 구하기
                var year = obj.substring(0, 4);
                var month = obj.substring(4, 6);
                var day = obj.substring(6, 8);
                var week = new Array(“일”, “월”, “화”, “수”, “목”, “금”, “토”);
                var vn_day1 = new Date(year, month – 1, day);
                var i = vn_day1.getDay(); //기준일의 요일을 구한다.( 0:일요일, 1:월요일, 2:화요일, 3:수요일, 4:목요일, 5:금요일, 6:토요일 )
                if ((i > 0) && (i < 7)) { //기준일이 월~토 일때
                    intDayCnt1 = 1 – i;
                    intDayCnt2 = 7 – i;
                }
                else if (i == 0) {  //기준일이 일요일일때
                    intDayCnt1 = -6;
                    intDayCnt2 = 0;
                }
                //기준일의 주의 월요일의 날짜와 토요일의 날짜
                var Cal_st = new Date(vn_day1.getYear(), vn_day1.getMonth(), vn_day1.getDate() + intDayCnt1);
                var Cal_en = new Date(vn_day1.getYear(), vn_day1.getMonth(), vn_day1.getDate() + intDayCnt2);
    //기준일 주의 마지막 해당 요일(첫주의 마지막 요일과 동일)  6:토요
    var Cal_last = new Date(vn_day1.getYear(), vn_day1.getMonth(), vn_day1.getDate() + intDayCnt1+(6-1));
                //날짜표시형식 첫번째 (예: 2008년 5월 1일)
                // var st_day = Cal_st.getYear()+”년 “+(Cal_st.getMonth()+1)+”월 “+Cal_st.getDate()+”일 “+ week[Cal_st.getDay()]+”요일”;
                // var en_day = Cal_en.getYear()+”년 “+(Cal_en.getMonth()+1)+”월 “+Cal_en.getDate()+”일 “+ week[Cal_en.getDay()]+”요일”;
                //날짜표시형식 두번째 (예: 20080501)
                var st_day2 = DateFormat(Cal_st);
                var en_day2 = DateFormat(Cal_en);
                //br = ‘<BR>’;
                //document.write (“기준일 : ” + obj + br);
                //document.write (“시작일(월) : ” + st_day + ” (” + st_day2 + “)” + br);
                //document.write (“종료일(일) : ” + en_day + ” (” + en_day2 + “)” + br);
                document.frmDate.txtSDate.value = st_day2;
                document.frmDate.txtEDate.value = DateFormat(Cal_last);
            }
      //–>
      </script>
     </head>
     <body>
      <form name=”frmDate”>
      <input type=”text” name=”txtSDate” value=””>
       <input type=”text” name=”txtEDate” value=””>
      </form>
     </body>
    </html>
    <script type=”text/javascript”>
    <!–
    //get_YesDate();
    get_Date(idate);
    //–>
    </script>