📄 tryit_view.asp@filename=trydhtml_move
字号:
<html>
<head>
<style>
img
{
position:absolute;
}
</style>
<script type="text/javascript">
document.onmousedown=coordinates;
document.onmouseup=mouseup;
function coordinates(e)
{
if (e == null) { e = window.event;}
var sender = (typeof( window.event ) != "undefined" ) ? e.srcElement : e.target;
if (sender.id=="moveMe")
{
mouseover=true;
pleft=parseInt(movMeId.style.left);
ptop=parseInt(movMeId.style.top);
xcoor=e.clientX;
ycoor=e.clientY;
document.onmousemove=moveImage;
return false;
}
else { return false; }
}
function moveImage(e)
{
if (e == null) { e = window.event;}
movMeId.style.left=pleft+e.clientX-xcoor+"px";
movMeId.style.top=ptop+e.clientY-ycoor+"px";
return false;
}
function mouseup(e)
{
document.onmousemove=null;
}
</script>
</head>
<body>
<img id="moveMe" src="smiley.gif" width="32" height="32" />
<p>Drag and drop the image</p>
<script type="text/javascript">
//The movable image
movMeId=document.getElementById("moveMe");
//image starting location
movMeId.style.top="75px";
movMeId.style.left="75px";
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -