java/js 右下脚浮动小窗口,慢慢上升,类似于广告窗口
2010-09-11 21:57
316 查看
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript">
<!--
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer;
function getMsg()
{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight + parseInt(document.body.scrollTop,10) + 5;
document.getElementById("eMeng").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth ;
document.getElementById("eMeng").style.visibility="visible";
objTimer = window.setInterval("moveDiv()",10);
}
//右下脚小窗口慢慢上升
function moveDiv(){
if(parseInt(document.getElementById("eMeng").style.top,10) < (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer);
return;
}
divTop = parseInt(document.getElementById("eMeng").style.top,10);
document.getElementById("eMeng").style.top = divTop - 2;
}
function resizeDiv()
{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight + parseInt(document.body.scrollTop,10) - divHeight ;
document.getElementById("eMeng").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth;
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility="hidden";
if(objTimer) window.clearInterval(objTimer);
}
window.onload = getMsg;
window.onresize = resizeDiv;
window.onscroll = resizeDiv;
-->
</script>
<body style="font-size:12px;">
<div id="eMeng" style="border:1px solid #7788CC;visibility:hidden;position:absolute;top:0px;left:0px;height:150px;width:260px;">
<div style="background-color:#7788FF;width:260px;height:20px;">
<div style="cursor:hand;font-size:12px;font-weight:bold;text-align:right;" onClick="closeDiv()">×</div>
</div>
<!--设计浮动窗口-->
<div style="border:3px solid #BBCCFF;background-color:#D5E7FD;width:260px;height:130px;">
<center>
<div id="myform">
这里设计想要的表单
<form name="myform" method="post">
<p>姓名:<input type="text"/></p>
<p>QQ: <input type="text"/></p>
<p>电话: <input type="text"/></p>
<p> <input type="submit" value="提交"/></p>
</form>
</div>
</center>
</div>
</div>
</body>
</html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript">
<!--
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer;
function getMsg()
{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight + parseInt(document.body.scrollTop,10) + 5;
document.getElementById("eMeng").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth ;
document.getElementById("eMeng").style.visibility="visible";
objTimer = window.setInterval("moveDiv()",10);
}
//右下脚小窗口慢慢上升
function moveDiv(){
if(parseInt(document.getElementById("eMeng").style.top,10) < (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer);
return;
}
divTop = parseInt(document.getElementById("eMeng").style.top,10);
document.getElementById("eMeng").style.top = divTop - 2;
}
function resizeDiv()
{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight + parseInt(document.body.scrollTop,10) - divHeight ;
document.getElementById("eMeng").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth;
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility="hidden";
if(objTimer) window.clearInterval(objTimer);
}
window.onload = getMsg;
window.onresize = resizeDiv;
window.onscroll = resizeDiv;
-->
</script>
<body style="font-size:12px;">
<div id="eMeng" style="border:1px solid #7788CC;visibility:hidden;position:absolute;top:0px;left:0px;height:150px;width:260px;">
<div style="background-color:#7788FF;width:260px;height:20px;">
<div style="cursor:hand;font-size:12px;font-weight:bold;text-align:right;" onClick="closeDiv()">×</div>
</div>
<!--设计浮动窗口-->
<div style="border:3px solid #BBCCFF;background-color:#D5E7FD;width:260px;height:130px;">
<center>
<div id="myform">
这里设计想要的表单
<form name="myform" method="post">
<p>姓名:<input type="text"/></p>
<p>QQ: <input type="text"/></p>
<p>电话: <input type="text"/></p>
<p> <input type="submit" value="提交"/></p>
</form>
</div>
</center>
</div>
</div>
</body>
</html>
相关文章推荐
- 用JS实现网页浮动窗口随窗口滚动(类似于客服窗口)
- 用JS实现网页浮动窗口随窗口滚动(类似于客服窗口)
- 用js写一个可以拖拽的浮动窗口
- js两栏浮动广告
- js漂浮窗口广告
- js 浮动div广告(对联广告)
- Kad -- 自己写的JS浮动广告代码封装器 支持FF/IE
- Atitit. 悬浮窗口的实现 java swing c# .net c++ js html 的实现
- js 浮动广告代码
- JS实现可缩放、拖动、关闭和最小化的浮动窗口完整实例
- JS实现广告浮动
- 用js屏蔽被http劫持的浮动广告实现方法
- 桌面浮动窗口(类恶意广告)
- JS实现可缩放、拖动、关闭和最小化的浮动窗口完整实例
- Atitit. 悬浮窗口的实现 java swing c# .net c++ js html 的实现
- JS右下角广告窗口代码(可收缩、展开及关闭)
- js实现类似于java的private
- js两侧浮动广告
- js实现从右向左缓缓浮出网页浮动层广告的方法
- js实现从右向左缓缓浮出网页浮动层广告的方法