JS弹出可以移动的DIV
来源:互联网 发布:淘宝新店铺如何装修 编辑:程序博客网 时间:2024/05/24 15:42
<html>
<head>
<title>可拖动DIV</title>
<script type="text/javascript">
function showProc(){
message_box.style.visibility='visible';
//创建灰色背景层
procbg = document.createElement("div");
procbg.setAttribute("id","mybg");
procbg.style.background = "#000";
procbg.style.width = "100%";
procbg.style.height = "100%";
procbg.style.position = "absolute";
procbg.style.top = "0";
procbg.style.left = "0";
procbg.style.zIndex = "500";
procbg.style.opacity = "0.3";
procbg.style.filter = "Alpha(opacity=30)";
//背景层加入页面
document.body.appendChild(procbg);
document.body.style.overflow = "hidden";
}
//拖动
function drag(obj){
var s = obj.style;
var b = document.body;
var x = event.clientX + b.scrollLeft - s.pixelLeft;
var y = event.clientY + b.scrollTop - s.pixelTop;
var m = function(){
if(event.button == 1){
s.pixelLeft = event.clientX + b.scrollLeft - x;
s.pixelTop = event.clientY + b.scrollTop - y;
}else {
document.detachEvent("onmousemove", m);
}
}
document.attachEvent("onmousemove", m)
if(!this.z)
this.z = 999;
s.zIndex = ++this.z;
event.cancelBubble = true;
}
function closeProc(){
message_box.style.visibility='hidden';
procbg.style.visibility = "hidden";
}
</script>
</head>
<body>
<input type="button" value="弹出可拖动DIV" onclick="showProc();" />
<div id="message_box" style="position:absolute;
left:10%;top:10%;width:80%;height:80%;
filter:dropshadow(color=#666666,offx=3,offy=3,positive=2);
z-index:1000;
visibility:hidden">
<div id= "message" style="border:#036 solid; border-width:1 1 3 1;
width:95%; height:95%;
background:#fff; color:#036; font-size:12px; line-height:150%;">
<!-- DIV弹出状态行:标题、关闭按钮 -->
<div style="background:#666; height:5%;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px; padding:3 5 0 5; color:#fff"
onmousedown="drag(message_box);return false">
<span style="display:inline;width:150px;position:absolute;font-size:200%">标题项</span>
<span onClick="closeProc();" style="float:right;display:inline;cursor:hand;font-size:200%">×</span>
</div>
具体内容,可以是表格也可以是DIV
</div><!-- message -->
</div><!-- message_box -->
</body>
</html>
- JS弹出可以移动的DIV
- JS弹出可以移动的DIV
- 可以移动的div弹出层
- div的js移动
- 弹出div的js实现
- JS弹出居中的DIV
- JS弹出居中的DIV
- JS弹出可移动的DIV对话框透明遮罩效果
- js实现div的移动
- js 弹出div窗口 可移动 可关闭
- js实现一个可以兼容PC端和移动端的div拖动效果
- JS弹出居中的DIV的代码
- JS弹出居中的DIV的代码
- JS弹出居中的DIV的代码
- js实现div弹出层的方法
- js弹出可以选择是否的对话框
- js弹出div层
- js弹出层(DIV)
- HDU 2044:一只小蜜蜂...【dp】
- 浅析Java web程序之客户端和服务器端交互原理
- centos6.6 安装python环境及Django 1.9.0
- symfony2框架
- 数据绑定数据库详解Android Data Binding Library
- JS弹出可以移动的DIV
- js获取对象的绝对坐标
- Spring-jdbc详解及案例<四>
- 在JS代码中获取Struts2中的返回值或者参数
- VC++中List Control控件的使用方法介绍
- IT从业人员想要提高薪酬水平的十种技能方法
- java 调用SqlServer分页存储过程的,返回多个结果集
- 关于多结果集的存储过程的处理
- Java 中 StringBuilder 在高性能用法总结