태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

<html>
<head>
    <title>http://www.blueb.co.kr</title>

<style type="text/css">
.dragclass{
    position : relative;
    cursor : move;
}
</style>

<script type="text/javascript">
if  (document.getElementById){

(function(){

if (window.opera){
document.write("<input type='hidden' id='Q' value=' '>");
}

var n = 500;
var dragok = false;
var y,x,d,dy,dx;

function move(e){
if (!e) e = window.event;
if (dragok){
  d.style.left = dx + e.clientX - x + "px";
  d.style.top  = dy + e.clientY - y + "px";
  return false;
}
}

function down(e){
    if (!e) e = window.event;
    var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
    if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){
        temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
    }
    if (temp.className == "dragclass"){
    if (window.opera){
        document.getElementById("Q").focus();
    }
        dragok = true;
        temp.style.zIndex = n++;
        d = temp;
        dx = parseInt(temp.style.left+0);
        dy = parseInt(temp.style.top+0);
        x = e.clientX;
        y = e.clientY;
        document.onmousemove = move;
    return false;
    }
}

function up(){
    dragok = false;
    document.onmousemove = null;
}

document.onmousedown = down;
document.onmouseup = up;

})();
}
</script>
</head>
<body>


<p class="dragclass" style="top:0px;left:0px;width:200px;text-align:center;background-color:#ff0000;color:#ffffff">P tag</p>

<div class="dragclass" style="height:20px;width:150px;top:0px;left:0px;background-color:#ff0000;color:#ffffff">Div: Relative position</div>

<img src="http://www.blueb.co.kr/SRC/javascript/image/010.gif" class="dragclass" style="top:0px;left:0px;padding:0px"/>

<b class="dragclass" style="top:0px;left:0px;background-color:#ff0000;color:#ffffff">B tag</b>

<div id="test" class="dragclass" style="position:absolute;top:330px;left:160px;height:20px;width:150px;background-color:#ff0000;color:#ffffff">
Div: Absolute position (절대위치)
</div>


</body>
</html> 
신고
Posted by 고시랑

티스토리 툴바