/*************************************************************************
************************* 팝업 관련 함수 *************************
**************************************************************************/
/*********************************************************************************
함수명 : openWindow
기 능 : 윈도우 띄우기
인 수 : theURL - Source
winName - 윈도우 명
feature - 윈도우 properties('width=530,height=450')
리턴값 :
**********************************************************************************/
function openWindow(theURL, winName, feature) {
var tmp_focus; if (feature=="" || feature==null) {
tmpFocus = window.open(theURL, winName );
} else {
tmpFocus = window.open(theURL, winName, feature );
}
tmpFocus.focus();
}
/*********************************************************************************
함수명 : openWinSize
기 능 : 윈도우 띄우기
인 수 : theURL - Source
winName - 윈도우 명
winWifth - 윈도우 가로크기
winHeight - 윈도우 세로크기
리턴값 :
**********************************************************************************/
function openWinSize(theURL, winName, winWidth, winHeight) {
var tmp_focus;
var winSize;
if ((winWidth=="" || winWidth==null) && (winHeight=="" || winHeight==null)) {
tmpFocus = window.open(theURL, winName );
}
else {
if (winWidth=="" || winWidth==null)
winSize = "height="+winWidth;
else if (winHeight=="" || winHeight==null)
winSize = "height="+winWidth;
else
winSize = "width="+winWidth+",height="+winWidth;
tmpFocus = window.open(theURL, winName, winSize );
}
tmpFocus.focus();
}
/*************************************************************************
************************* 이미지 팝업 관련 함수 *************************
**************************************************************************/
// function imageAutoResize(img){
// img1= new Image();
// img1.src=(img);
// imgControll(img);
//}
function imageAutoResize(image_URL){
full_image = new Image();
full_image["src"] = image_URL;
// Netscape 때문에 다음 코드를 넣어줌
//var str = "";
//for (var propName in full_image) {
// str += propName + ":" + full_image[propName] + ", ";
//}
//alert(str);

i = 0;
img_width = 0;
img_height = 0;
var str = "";

// Netscape 때문에 Loop 넣어줌
do {
i += 1;

img_width = full_image["width"];
img_height = full_image["height"];
str += i + "= width:" + img_width + ", height:" + img_height + "\n";
} while(i < 40 && (img_width == "0" || img_height == "0"));
if(img_width == "0" || img_height == "0")
{
img_width = 600;
img_height = 500
}
else
{
if(img_width > 660)
img_width = 660;
if(img_height > 500)
img_height = 500;
img_width += 40;
img_height += 45;
}

var full_win = window.open(image_URL, "full_image_win", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,Width="+img_width+",Height="+img_height);
full_win.focus();
}
function imgControll(img){
if((img1.width!=0)&&(img1.height!=0)){
viewImage(img);
}
else{
controller="imgControll('"+img+"')";
intervalID=setTimeout(controller,20);
}
}
function viewImage(img){
W=img1.width;
H=img1.height;
O="width="+W+",height="+H;
imgWin=window.open("","",O);
imgWin.document.write("<html><head><title>확대보기</title></head>");
imgWin.document.write("<body topmargin=0 leftmargin=0>");
imgWin.document.write("<img src='"+img+"' omclick='self.close()'>");
imgWin.document.close();
}
[출처] 팝업관련함수|작성자 송욱이네

+ Recent posts