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>
查看全文
相关阅读:
第五周总结
10.24号进度报告
10.23日进度报告
10.22日进度报告
10.21日进度报告
10.20号进度总结
10.19日进度总结
第四周总结
10.18日进度博客
2020下第六周总结
原文地址:https://www.cnblogs.com/HD/p/101408.html
最新文章
一个简单的例子深入了解ssm框架
Springmvc+mybatis+ajax的最易懂的搭建方式
SpringMvc项目的创建(前后端分离和不分离)
vue详解
SpringMvc的IOC思想
程序员必须懂得前端基础知识
idea项目导入其他项目的依赖详解
前后端分离是什么
struts2学习笔记-搭建Struts2开发环境--开发Struts2应用依赖的jar文件
HashMap与Hashtable的区别
热门文章
labeled statement:标签语句
Values & Reference:值和引用
prototype:构造函数的真相、原型链
Object value iterator:值迭代器
怎样判断JS对象中的属性
js的作用域
Module loader:模块加载器
修改Linux默认启动级别或模式的方法
移动web开发问题集
10.25进度
Copyright © 2011-2022 走看看