java/js 右下脚浮动小窗口,慢慢上升,类似于广告窗口

<%@ 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>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值