Dragging In Browser Using DHTML
Sharing the information with fellow programmers
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
<html>
<head>
<title>Dragging In browser</title>
<meta name="Keywords" content="Dragging in DHTML by Sanjeev Kaushik" />
<meta name="Description" content="Dragging in DHTML by Sanjeev Kaushik,HTML,CSS,JavaScript,DHTML" />
<script language=javascript>
function go(){
if (event.button!=1)
return;
mydiv = eval("document.all.my");
temp1 = mydiv.style.posLeft;
temp2 = mydiv.style.posTop;
xpos = event.clientX;
ypos = event.clientY;
xoff = temp1-xpos;
yoff = temp2-ypos;
mydiv.onmousemove = mymove;
}
function mymove(){
if (event.button==1){
x = event.clientX + xoff
y = event.clientY + yoff;
mydiv.style.pixelLeft = x;
mydiv.style.pixelTop =y
return false;
}
}
</script>
</head>
<body>
<div title="press left button and drag" align=center onmousedown="go()" id="my" style="position:absolute;left:100;top:100;width:150;background-color:maroon;filter:alpha(style=3);cursor:hand">
<font color=yellow>Sanjeev Kaushik</font>
<!-- you can also add any image here -->
</div>
</body>
</html>
Original Comments (3)
Recovered from Wayback Machine