팝업창 경고창 후 부모창 리플레시 function 정보
팝업창 경고창 후 부모창 리플레시 function
본문
재가 자주 쓰는 function 인대 그누에는 없어서 도움 되실까 해서 올립니다.
common.lib.php 에 삽입하시고 사용하시면되용
원본을 건드리기 싫으신분은 extend 에 function.lib.php 만드셔서 하셔도되구요
1. 팝업창으로 입력창등을 띠웠을때 입력후 부모창을 리플레시 후 해당 팝업창을 닫아주거나
또는, 부모창만 리플레시 하기위해 사용합니다.
// 경고메세지 후 부모페이지 리로드 후 팝업창닫기
function alert_replace($target='', $msg='', $close=1)
{
global $g4;
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
//header("Content-Type: text/html; charset=$g4[charset]");
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4[charset]\">";
echo "<script language='javascript'>alert('$msg');";
if ($close)
echo "window.close();";
if (!$target)
echo "$target.location.reload();";
echo "</script>";
exit;
}
2. 팝업창으로 입력창등을 띠웠을때 입력후 부모창을 리플레시 후 해당 팝업창을
이동 하기 위해서 사용합니다.
// 경고메세지 후 부모페이지 리로드 후 페이지이동
function alert_replace_url($msg='', $url='', $target='')
{
global $g4;
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
//header("Content-Type: text/html; charset=$g4[charset]");
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4[charset]\">";
echo "<script language='javascript'>alert('$msg');";
if ($target)
echo "$target.location.reload();";
echo "</script>";
if ($url)
// 4.06.00 : 불여우의 경우 아래의 코드를 제대로 인식하지 못함
//echo "<meta http-equiv='refresh' content='0;url=$url'>";
goto_url($url);
exit;
}
1
댓글 1개

// 경고메세지 후 부모페이지 리로드 후 팝업창닫기
function alert_replace($target='', $msg='', $close=1)
{
global $g4;
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
//header("Content-Type: text/html; charset=$g4[charset]");
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$g4[charset]\">";
echo "<script language='javascript'>alert('$msg');";
if ($close)
echo "window.close();";
if (!$target)
echo "$target.location.reload();";
echo "</script>";
exit;
}
에서 if (!$target) 느낌표가 빠져야 할거 같습니다~~
추천~