경로가 다른 파일안에서 함수를 제어할수 있을까요?
경로가 다른 두 파일이 있는데 같은 함수를 제어해야하는 일이 있는데
어떻게 하면 좋을까요 그냥 적어 놓으니 안먹히네요 ..
하나는 /contact.php 에서 <?=latest("basic1", "52", 8, 30)?> 최근글로 불러온 latest>basic1>latest.skin.php 안에서 openWin1
함수를 사용하였고
<script language="javascript" type="text/javascript">
<!--
function openWin1(){
window.open("/contact_pop.php", "문의하기", "top=100, left=200, width=816, height=800, toolbar=no, location=no, menubar=no, status=no, scrollbars=no, resizable=no, directories=no" );
}
//-->
</script>
다른하나는 /notice.php 에서 <?=latest("basic", "51", 8, 30)?> 최근글로 불러온 latest>basic>latest.skin.php 안에 openWin 함수를 사용했는데
<script language="javascript" type="text/javascript">
<!--
function openWin(){
window.open("/notice_pop.php", "공지사항", "top=100, left=200, width=816, height=800, toolbar=no, location=no, menubar=no, status=no, scrollbars=no, resizable=no, directories=no" );
}
//-->
</script>
최근글 목록을 클릭했을때 윈도우 팝업으로 뜨는데 다른 윈도우 팝업이 닫혀야 되서 하나의 최근글 스킨에서 두개의 함수를 다 제어할수 있는 방법이 없을까요?
답변 4개 / 댓글 3개
페이지 이동이 없다면 가능하지만 일단 페이지가 이동이 되면 불가능합니다.
답변에 대한 댓글 2개
이걸 원하시는지 모르겠습니다.
두가지 소스인데 요점은 타겟 그룹을 같이 주고, 새창에 포커스를 주면 뒤로 묻히지 않고 새내용의 새창이 항상 앞으로 올라옵니다.
<script type="text/javascript"> // 1 function OpenWin_smart(Url,Target,Xsize,Ysize,left_is,top_is,Scroll,Resize){ if(Resize != 'no' && Resize != 0 ) Resize=1; var winwhitch=(left_is >0 || top_is>0)? ',left='+left_is+',top='+top_is+',' : ''; smart_Browser=window.open(Url,Target,'width='+Xsize+',height='+Ysize + winwhitch + ',scrollbars='+Scroll+',resizable='+Resize+',status=0'); smart_Browser.focus(); } // 2 var pop_win = null;function win_group( type ) { if(type == "group1" ) pop_win = window.open('', 'pop_win', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=750,height=600,top=30,left=30'); else if(type == "group2" ) pop_win = window.open('', 'pop_wina', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=430,height=400,left=0,top=0'); else alert("Fatal : in function win_group()"); pop_win.focus(); return;}</script><!-- 1 --><a href="#" onclick="OpenWin_smart('http://www.jemg.co.kr/skin/shop/ajax-bs/type-1.php','group1',400,400,100,100,1,1)">1111</a><a href="#" onclick="OpenWin_smart('http://www.jemg.co.kr/skin/shop/ajax-bs/type-2.php','group1',400,400,100,100,1,1)">2222</a><!-- 2 --><a href="http://www.jemg.co.kr/skin/shop/ajax-bs/type-1.php" target='pop_win' onClick="win_group('group1')">aaa</a><a href="http://www.jemg.co.kr/skin/shop/ajax-bs/type-2.php" target='pop_win' onClick="win_group('group1')">bbb</a>
답변을 작성하려면 로그인이 필요합니다.
