{
dragObj.dragFlag = false;
}
dragObj.dragProc = function(event) // ドラッグ中の処理
{
mouseX = Event.pointerX(event);
mouseY = Event.pointerY(event);
if (!dragObj.dragFlag) return;
dragObj.targetObj.style.left = mouseX - dragObj.offsetX;
dragObj.targetObj.style.top = mouseY - dragObj.offsetY;
return false;
}
window.onload = function() // イベントハンドラなどを設定
{
eleName = "mainContents";
$(eleName).onmousedown = dragObj.dragStart;
$(eleName).onmouseup = dragObj.dragEnd;
$(eleName).style.left = "60px";
$(eleName).style.top = "50px";
Event.observe(window.document, "mousemove", dragObj.dragProc, false);
}
// --></script>
</head>
<body>
<h1>ドラッグ処理</h1>
<div id="mainContents">
ここをドラッグできます。
</div>
</body>
</html>