메뉴 건너뛰기

조회 수 1329 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

<html>
<head>
<title></title>
</head>
<body>
<script language="javascript">
 function BlooMsg(obj){  
  var obj
  var div = eval("document.all.div_" + obj);
  
  if (div.style.display == ''){
   div.style.display = "none";
   
  } else {
   div.style.top = event.y - 10 - document.body.scrollTop;
   div.style.left = event.x + 10;
   div.style.display = "";
   
  }
 }
</script>

<div id="div_1" style='display:none;position:absolute'>
<table border="0"  cellpadding="3" cellspacing="1" bgcolor="#0066FF" width="100">
 <tr>
  <td bgcolor="#FFFFCC">친구추가</td>  
 </tr>
 <tr>
  <td bgcolor="#FFFFCC"><a href="/disk/main.jsp">디스크로 이동</a></td>
 </tr>
</table>
</div>
<a href="#" onclick="javascript:BlooMsg('1');">클릭이벤트</a>
</body>
</html>

 

------------------------------------------------------------------------------------------

 

/**
출 처 : http://tost.tistory.com/12
제 목 : [js] 레이어를 중앙에 띄우기
날 짜 : 2008/11/01 10:22
중 요 : 
소요 시간 : 
환 경 : 
기 타 : 
*****/

 

<HTML>
<HEAD>
<TITLE> 샘플코드모음 </TITLE>
<META NAME="Author" CONTENT="정민철 minchul.jeong@konantech.com">
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<script>
  function CenterLayer(div_id)
  {
    var obj = document.getElementById(div_id);
    var x = 0;
    var y = 0;
    var div_width = 0;  // 레이어 가로크기
    var div_height = 0; // 레이어 세로크기

    if (obj != null)
    {
      // [1] 레이어 크기 구하기
      div_width  = parseInt(obj.style.width);
      div_height = parseInt(obj.style.height);
     

      // [2] 레이어를 위치시킬 x, y좌표 구하기
      x = (document.body.clientWidth - div_width) / 2;
      y = (document.body.clientHeight - div_height) /2;
     

      // [3] 좌표변경
      obj.style.top = y + "px";
      obj.style.left = x + "px";
    
    }
  }
</script>
</HEAD>
<BODY onload="CenterLayer('div_1')" onresize="CenterLayer('div_1');">

<div id="div_1" style="position:absolute; width:400px; height:300px; BACKGROUND: gray; ">
* 레이어의 크기와 body의 크기를 알아내서 top과 left의 값을 조정한다
</div>

</BODY>
</HTML>


List of Articles
번호 제목 날짜 조회 수
207 iframe 높이 자동으로 잡아주기 2014.03.01 5855
206 iframe 아이프레임 내용 길이에 따라서 높이가 자동으로 조절 되도록 2014.02.27 6206
205 iframe 자동 리사이즈 2014.03.01 5992
204 iframe사용시 높이 자동 조절 2015.06.19 6958
203 iframe을 리로드 하자! 2014.03.01 5933
202 input radio 체크유무 검사 2016.09.11 5562
201 input type checkbox 체크했는지 검사하는 소스 2014.03.01 5469
200 input type file multiple list (파일 업로드 리스트 확인) file 2016.11.17 12437
199 input 박스에서 유용한 자바 스크립트 2014.02.27 5455
198 input 빈칸 체크 2014.03.01 6271
197 input 태그에서 name과 id의 차이 2019.01.16 1104
196 input 테그안의 숫자 3자리 마다 콤마 찍기 2014.03.01 6077
195 input에 background-image 이벤트 2014.03.01 5356
194 Javascript - Calendar 달력 생성하고 제어하기 2021.03.09 513
193 Javascript - form태그 내부 ajax처리시 2번 전송되는 현상 2021.03.09 268
192 Javascript - Free SVG 한국맵 제어 처리 file 2021.03.09 873
191 javascript - vanillaJS로 체크박스(checkbox) 제어하기 file 2021.03.09 498
190 Javascript - 사업자 등록번호 유효성 체크 file 2021.03.09 1089
189 Javascript - 유효성 체크(이메일 정규식, IP 정규식, 비밀번호 등) 2021.03.09 729
188 Javascript - 이미지 미리보기 회전되어 나옴(EXIF) file 2021.03.09 36361
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved