zoukankan
html css js c++ java
页面上的可鼠标移动内嵌页面层,并有关闭按钮,背景不可点击
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>
<
HTML
>
<
HEAD
>
<
META
http-equiv
='Content-Type'
content
='text/html;
charset
=gb2312'
>
<
TITLE
>
页面上的可鼠标移动内嵌页面层,并有关闭按钮,背景不可点击
</
TITLE
>
<
STYLE
type
=text/css
>
#floater
{
}
{
LEFT
:
241px
;
POSITION
:
absolute
;
TOP
:
55px
;
VISIBILITY
:
visible
;
WIDTH
:
160px
;
Z-INDEX
:
10
;
z-index
:
101
;
}
</
STYLE
>
<
style
type
="text/css"
>
.divmark
{
}
{
position
:
absolute
;
z-index
:
100
;
top
:
0px
;
left
:
0px
;
background-color
:
#000
;
filter
:
alpha(opacity=30)
;
}
</
style
>
<
script
>
<!--
function
showIframeURL(url)
{
var
Wait
=
document.getElementById(
"
floater
"
);
Wait.style.display
=
""
;
var
f
=
document.getElementById(
"
iframe
"
);
f.src
=
url;
f.width
=
"
100%
"
;
f.height
=
"
100%
"
;
document.getElementById(
"
overlay
"
).style.display
=
""
;
document.getElementById(
"
overlay
"
).style.height
=
document.documentElement.clientHeight;
document.getElementById(
"
overlay
"
).style.width
=
document.documentElement.clientWidth;
}
function
MM_findObj(n, d)
{
//
v4.01
var
p,i,x;
if
(
!
d) d
=
document;
if
((p
=
n.indexOf(
"
?
"
))
>
0
&&
parent.frames.length)
{
d
=
parent.frames[n.substring(p
+
1
)].document; n
=
n.substring(
0
,p);}
if
(
!
(x
=
d[n])
&&
d.all) x
=
d.all[n];
for
(i
=
0
;
!
x
&&
i
<
d.forms.length;i
++
) x
=
d.forms[i][n];
for
(i
=
0
;
!
x
&&
d.layers
&&
i
<
d.layers.length;i
++
) x
=
MM_findObj(n,d.layers[i].document);
if
(
!
x
&&
d.getElementById) x
=
d.getElementById(n);
return
x;
}
function
MM_showHideLayers()
{
//
v6.0
var
i,p,v,obj,args
=
MM_showHideLayers.arguments;
for
(i
=
0
; i
<
(args.length
-
2
); i
+=
3
)
if
((obj
=
MM_findObj(args[i]))
!=
null
)
{ v
=
args[i
+
2
];
if
(obj.style)
{ obj
=
obj.style; v
=
(v
==
'show')
?
'visible':(v
==
'hide')
?
'hidden':v; }
//
obj.visibility=v;
obj.display
=
"
none
"
;document.getElementById(
"
overlay
"
).style.display
=
"
none
"
;}
}
//
-->
</
script
>
</
HEAD
>
<
SCRIPT
language
=JavaScript
>
self.onError
=
null
;
currentX
=
currentY
=
0
;
whichIt
=
null
;
lastScrollX
=
0
; lastScrollY
=
0
;
NS
=
(document.layers)
?
1
:
0
;
IE
=
(document.all)
?
1
:
0
;
<!--
STALKER CODE
-->
function
heartBeat()
{
if
(IE)
{ diffY
=
document.body.scrollTop; diffX
=
document.body.scrollLeft; }
if
(NS)
{ diffY
=
self.pageYOffset; diffX
=
self.pageXOffset; }
if
(diffY
!=
lastScrollY)
{
percent
=
.
1
*
(diffY
-
lastScrollY);
if
(percent
>
0
) percent
=
Math.ceil(percent);
else
percent
=
Math.floor(percent);
if
(IE) document.all.floater.style.pixelTop
+=
percent;
if
(NS) document.floater.top
+=
percent;
lastScrollY
=
lastScrollY
+
percent;
}
if
(diffX
!=
lastScrollX)
{
percent
=
.
1
*
(diffX
-
lastScrollX);
if
(percent
>
0
) percent
=
Math.ceil(percent);
else
percent
=
Math.floor(percent);
if
(IE) document.all.floater.style.pixelLeft
+=
percent;
if
(NS) document.floater.left
+=
percent;
lastScrollX
=
lastScrollX
+
percent;
}
}
<!--
/
STALKER CODE
-->
<!--
DRAG DROP CODE
-->
function
checkFocus(x,y)
{
stalkerx
=
document.floater.pageX;
stalkery
=
document.floater.pageY;
stalkerwidth
=
document.floater.clip.width;
stalkerheight
=
document.floater.clip.height;
if
( (x
>
stalkerx
&&
x
<
(stalkerx
+
stalkerwidth))
&&
(y
>
stalkery
&&
y
<
(stalkery
+
stalkerheight)))
return
true
;
else
return
false
;
}
function
grabIt(e)
{
if
(IE)
{
whichIt
=
event.srcElement;
while
(whichIt.id.indexOf(
"
floater
"
)
==
-
1
)
{
whichIt
=
whichIt.parentElement;
if
(whichIt
==
null
)
{
return
true
; }
}
whichIt.style.pixelLeft
=
whichIt.offsetLeft;
whichIt.style.pixelTop
=
whichIt.offsetTop;
currentX
=
(event.clientX
+
document.body.scrollLeft);
currentY
=
(event.clientY
+
document.body.scrollTop);
}
else
{
window.captureEvents(Event.MOUSEMOVE);
if
(checkFocus (e.pageX,e.pageY))
{
whichIt
=
document.floater;
stalkerTouchedX
=
e.pageX
-
document.floater.pageX;
StalkerTouchedY
=
e.pageY
-
document.floater.pageY;
}
}
return
true
;
}
function
moveIt(e)
{
if
(whichIt
==
null
)
{
return
false
; }
if
(IE)
{
newX
=
(event.clientX
+
document.body.scrollLeft);
newY
=
(event.clientY
+
document.body.scrollTop);
distanceX
=
(newX
-
currentX); distanceY
=
(newY
-
currentY);
currentX
=
newX; currentY
=
newY;
whichIt.style.pixelLeft
+=
distanceX;
whichIt.style.pixelTop
+=
distanceY;
if
(whichIt.style.pixelTop
<
document.body.scrollTop) whichIt.style.pixelTop
=
document.body.scrollTop;
if
(whichIt.style.pixelLeft
<
document.body.scrollLeft) whichIt.style.pixelLeft
=
document.body.scrollLeft;
if
(whichIt.style.pixelLeft
>
document.body.offsetWidth
-
document.body.scrollLeft
-
whichIt.style.pixelWidth
+
17
) whichIt.style.pixelLeft
=
document.body.offsetWidth
-
whichIt.style.pixelWidth
+
17
;
//
if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue
=
false
;
}
else
{
whichIt.moveTo(e.pageX
-
StalkerTouchedX,e.pageY
-
StalkerTouchedY);
if
(whichIt.left
<
0
+
self.pageXOffset) whichIt.left
=
0
+
self.pageXOffset;
if
(whichIt.top
<
0
+
self.pageYOffset) whichIt.top
=
0
+
self.pageYOffset;
if
( (whichIt.left
+
whichIt.clip.width)
>=
(window.innerWidth
+
self.pageXOffset
-
17
)) whichIt.left
=
((window.innerWidth
+
self.pageXOffset)
-
whichIt.clip.width)
-
17
;
if
( (whichIt.top
+
whichIt.clip.height)
>=
(window.innerHeight
+
self.pageYOffset
-
17
)) whichIt.top
=
((window.innerHeight
+
self.pageYOffset)
-
whichIt.clip.height)
-
17
;
return
false
;}
return
false
;
}
function
dropIt()
{
whichIt
=
null
;
if
(NS) window.releaseEvents (Event.MOUSEMOVE);
return
true
;
}
<!--
DRAG DROP CODE
-->
if
(NS)
{
window.captureEvents(Event.MOUSEUP
|
Event.MOUSEDOWN);
window.onmousedown
=
grabIt;
window.onmousemove
=
moveIt;
window.onmouseup
=
dropIt;
}
if
(IE)
{
document.onmousedown
=
grabIt;
document.onmousemove
=
moveIt;
document.onmouseup
=
dropIt;
}
if
(NS
||
IE) action
=
window.setInterval(
"
heartBeat()
"
,
1
);
</
SCRIPT
>
<
BODY
style
="font-size:12px;"
>
<
div
style
="float:right;"
><
a
href
="JavaScript:void(0);"
onClick
="showIframeURL('http://www.baidu.com')"
>
百度
</
a
>
|
<
a
href
="JavaScript:void(0);"
onClick
="showIframeURL('http://www.google.com')"
>
Google
</
a
></
div
>
<
span
align
="center"
id
="floater"
style
="HEIGHT: 300px; WIDTH: 500px; border:solid #cccccc 1px; border-top-2px;font-size:12px;display:none;"
>
<
div
style
="background:#cccccc;padding:3px;height:12px;"
><
div
style
="float:left;"
>
编辑楼号名称
</
div
><
div
style
="float:right;"
><
a
href
="JavaScript:void(0);"
style
="color:black;text-decoration:none;"
onClick
="MM_showHideLayers('floater','','hide')"
title
="关闭窗口"
>
[Close]
</
a
></
div
>
</
div
>
<
iframe
id
="iframe"
width
="0"
height
="0"
scrolling
="no"
frameborder
="0"
marginwidth
="0"
marginheight
="0"
style
="clear:both;"
></
iframe
>
</
span
>
<
div
id
="overlay"
class
="divmark"
></
div
>
</
BODY
></
HTML
>
<
script
language
="javascript"
>
document.all.overlay.oncontextmenu
=
function
()
{
return
false
;
}
;
</
script
>
查看全文
相关阅读:
排序算法与数据结构复习总结
Kafka知识总结及面试题
深入理解Redis系列之事务
深入理解Redis系列之持久化
基于数据库、redis和zookeeper实现的分布式锁
深入理解MySQL系列之优化
Mysql-主从复制(Docker)
Mysql-GTID主从复制
Ansible基础
Nginx + php-fpm源码编译
原文地址:https://www.cnblogs.com/timy/p/923924.html
最新文章
浅尝装饰器-@staticmethod 和@classmethod
浅尝装饰器--property装饰器
python的参数传递是值传递还是引用传递?都不是!
八大排序算法之基数排序(python实现)
MmjCQULjEx
scrapy爬虫简单项目入门练习
pycharm环境下配置scrap爬虫环境
Linux系统数字权限解释
centos-7下解决yum -y install mysql-server没有可用包
shell中的while循环实例
热门文章
shell脚本for循环批量创建用户
linux中的光盘挂载与卸载
Shell脚本编程的条件测试和if条件语句使用方法
已加载插件:fastestmirror, langpacks /var/run/yum.pid 已被锁定,PID 为 2323 的另一个程序正在运行。
CentOS-7 yum安装出现/var/run/yum.pid 已被锁定,解决办法
已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile There are no enabled repos. Run "yum repolist all" to see the repos you have. To enable Red Hat Subscription
Elasticsearch之深入理解
面试题:线程池内线程没有catch处理,抛出异常,线程池会怎么办?
Netty中使用的设计模式
Spring中使用的设计模式
Copyright © 2011-2022 走看看