function addKeyImg(imgDiv,fileObj,fileObjValue){

var imgPath = '';


//파일형식이 이미지형식이 아닌경우  

if(!/(\.gif|\.jpg|\.jpeg|\.png)$/i.test(fileObj.value) && fileObj.value !='') {

   alert("이미지 형식의 파일을 선택하십시오");

   fileObj.select();

   document.selection.clear();   

   return;

   

//파일형식이 맞는경우

}else{  

var imgDiv = (typeof(imgDiv) == "object") ? imgDiv : document.getElementById(imgDiv);

var ua = window.navigator.userAgent;

            if (ua.indexOf("MSIE") > -1) { //IE 

                if (fileObj.value.indexOf("\\fakepath\\") < 0) {

                imgPath = fileObj.value;

                } else {

                fileObj.select();

                    var selectionRange = document.selection.createRange();

                    imgPath = selectionRange.text.toString();

                    //fileObj.blur();

                    imgDiv.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fi" + "le://" + imgPath + "', sizingMethod='scale')";

                }

                

} else { //파폭적용

            }

}

}

+ Recent posts