zoukankan
html css js c++ java
[JavaScript]鼠标拖动
代码很简单:
<div id="divMove" style="POSITION: absolute;left:300;top:300" onselectstart="return false" onmousedown="MouseDown(this)" onmousemove="MouseMove()"> <table width="150" cellpadding="0" cellspacing="0" border="1"> <tr> <td height="30" bgcolor="#cccccc">title</td> </tr> <tr> <td height="100"><p align="center">testMove</p></td> </tr> </table> </div> <SCRIPT LANGUAGE="JavaScript"> <!-- var currentMoveObj = null; var relLeft,relTop; function MouseDown(obj) { currentMoveObj = obj; currentMoveObj.style.position = "absolute"; relLeft = event.x - currentMoveObj.style.pixelLeft; relTop = event.y - currentMoveObj.style.pixelTop; } window.document.onmouseup = function() { currentMoveObj = null; } function MouseMove() { if(currentMoveObj != null) { currentMoveObj.style.pixelLeft=event.x-relLeft; currentMoveObj.style.pixelTop=event.y-relTop; } } //--> </SCRIPT>
查看全文
相关阅读:
基于MATLAB静态目标分割的药板胶囊检测
基于YCbCr色彩模型的简易肤色识别器
思考一个问题STM32的
压力校准仪开发日志-10-21 迪文屏通信命令记录
迪文屏使用须知
结构体变量字节填充
sizeof 的妙用
结构体内存的对齐方式
内存对齐
中国游戏产业走向世界
原文地址:https://www.cnblogs.com/HD/p/101408.html
最新文章
软考知识点梳理--项目章程
项目忙还要过软考,您需要简练!
Web开发模型
网络编程
DOM编程
死锁
线程同步实现售票
BOM编程
线程
对象流
热门文章
css
html
霍普菲尔得神经网络(Hopfield Neural Network)
[ 1 x 1 ] Convolution-1*1卷积的作用
区块链是什么以及技术原理和应用背景
RS485通信电路
EEPROM存储电路(M24C64芯片)
STM32单片机最小系统
光速测定与引力波探测概述
模电Multisim仿真Rb变化对Q点和电压放大倍数的影响
Copyright © 2011-2022 走看看