JAVASCRIPT DIV 팝업창 이동 , 닫기

<script>
 //레이어 이동
 var oleft = otop = mact = null;
 nleft = 10;
 ntop = 10;
 //마우스 액션

 function ckmouse(e){
  if(e == 1){
   oleft = event.x + document.body.scrollLeft - nleft;
   otop = event.y + document.body.scrollTop - ntop;
   mact = 1;
  }else if(e == 2){
   nleft = event.x + document.body.scrollLeft - oleft;
   ntop = event.y + document.body.scrollTop - otop;
   mact = null;
  }else if(e == 3 && event.button == 1 && mact){
   document.getElementById('layer').style.left = event.x + document.body.scrollLeft - oleft;
   document.getElementById('layer').style.top = event.y + document.body.scrollTop - otop;
   nleft = event.x + document.body.scrollLeft - oleft;
   ntop = event.y + document.body.scrollTop - otop;
  }
   return;
 }
</script>

<div id='layer' style='position:absolute;left:10; top:10;display:none;'>

<table width='300' cellspacing='0' cellpadding='3' style='border:1 solid black' style='font-size:12px;font-family:고딕체;'>

<tr bgcolor='silver' height='17' onmousedown='ckmouse(1);' onmouseup='ckmouse(2)' onmousemove='ckmouse(3, "layer");' style='cursor=move'>

<td align='center' width='100%'>공지사항</td><td width='10px' align='right'><a href="javascript:" onclick="document.getElementById('layer').style.display='none'" style='color:black;text-decoration:none;'>■</a></td>

</tr><tr>

<td colspan='2' align='center'>12121212
121212121212341234124asfasfasfasfasfasfasfaeaweafafe
afasfdasf<br><br></td>

</tr>

</table>

</div>

<a href='#' onclick="document.getElementById('layer').style.display='block'">Show</a>

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다