zoukankan
html css js c++ java
层拖动Drag Div
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> <body> <script type="text/javascript"> <!-- function $(id) { return document.getElementById(id); } var g_CatchDiv = false; var g_obj; var g_objName; function CatchMoveDiv(obj, name) { window.setTimeout('g_CatchDiv = true', 200); g_obj = obj; g_objName = name; var oMove = $('divMove'); var MoveObj = obj; oMove.innerHTML = MoveObj.outerHTML; oMove.style.cursor = ''; oMove.style.filter = 'alpha(opacity=50)'; // document.body.style.filter = 'alpha(opacity = 30)'; // oMove.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=50)'; oMove.style.left = event.x - 35; oMove.style.top = event.y + 10; oMove.setCapture(); document.onmouseup = function() {ReleaseDiv();}; document.onmousemove = function() {MoveDiv();}; } function ReleaseDiv() { window.setTimeout('g_CatchDiv = false', 200) var oMove = $('divMove'); oMove.style.display = 'none'; oMove.releaseCapture(); document.onmousemove = null; } function MoveDiv() { if (g_CatchDiv) { var oMove = $('divMove'); oMove.style.left = event.x - 35; oMove.style.top = event.y; oMove.style.display = ''; } } //--> </script> <div id="divA" style="cursor:pointer; border:solid 1px" onmousedown="if (!g_CatchDiv) {CatchMoveDiv(this, this.innerText);}" onmousemove="if (g_CatchDiv && g_obj != this) {if (confirm('你确定将〖' + g_objName + '〗移动到〖' + this.innerText + '〗下吗?')) {}}">AAA</div> <div> </div> <div id="divB" style="cursor:pointer; border:solid 1px" onmousedown="if (!g_CatchDiv) {CatchMoveDiv(this, this.innerText);}" onmousemove="if (g_CatchDiv && g_obj != this) {if (confirm('你确定将〖' + g_objName + '〗移动到〖' + this.innerText + '〗下吗?')) {}}">BBB</div> <div id="divMove" style="position:absolute;display:none; z-index:0;"></div> <input id="btnSubmit" type="submit" onmousedown="if (!g_CatchDiv) {CatchMoveDiv(this, this.value);}" onmousemove="if (g_CatchDiv && g_obj != this) {if (confirm('你确定将〖' + g_objName + '〗移动到〖' + this.value + '〗下吗?')) {}}" value="Submit" /> <input type="reset" onmousedown="if (!g_CatchDiv) {CatchMoveDiv(this, this.value);}" onmousemove="if (g_CatchDiv && g_obj != this) {if (confirm('你确定将〖' + g_objName + '〗移动到〖' + this.value + '〗下吗?')) {}}" value="Reset" /> </body> </html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
青苹果Web应用商店
https://webapp.taobao.com/
PHP/ASP.NET/ASP/UCHOME/DISCUZ! X系列网站开发,详细需求联系
QQ:8511978
查看全文
相关阅读:
Spring Boot 学习随记
Prometheus 普罗米修斯监控
安装VC++6.0步骤及心得
NFS 系统搭建
Centos 搭建邮箱系统
搭建 RTMP 服务器
阿里云 DTS 实践
ELK 搭建
Prometheus 和 Grafana 安装部署
Centos7 Nagios 搭建
原文地址:https://www.cnblogs.com/Dicky/p/DragDiv.html
最新文章
第一篇博客
图片懒加载
Scrapy框架(六)--图片数据抓取
提升Scrapy的爬取效率
Scrapy框架(五)--请求传参
Scrapy框架(四)--五大核心组件
Scrapy框架(三)--全站数据爬取
Scrapy框架(二)--持久化存储
Scrapy框架(一)--初识
(五)基于selenium实现12306模拟登陆
热门文章
Selenium模块的使用(二)
SSL/TLS 原理详解
oracle数据类型和对应的java类型
String 将GBK转UTF-8
统计学 学习第一季第一集《统计学习方法》第一章 统计学方法概论 简要概述
[spring+tomcat]启动时报错:NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I
oracle 数据库字段名与实体类字段名称不匹配的处理方法
JVM 什么时候会触发FGC
Mybatis 异常记录(1): Invalid bound statement (not found)
杜绝网上压根没测过就乱写之 《oracle mybatis 返回自增主键 》
Copyright © 2011-2022 走看看