日期:2014-05-16  浏览次数:20400 次

JS右下角弹出窗口
<HTML>
<HEAD>
<TITLE> 右下角提示窗口 </TITLE>
<META NAME="Keywords" CONTENT="提示窗口">
<META NAME="Description" CONTENT="提示窗口">
<script type="text/javascript">
<!--
<!--右下脚弹出窗口开始-->
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;

function getMsg()
{
  try
  {
   divTop = parseInt(document.getElementById("loft_win").style.top,10);
   divLeft = parseInt(document.getElementById("loft_win").style.left,10);
   divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
   divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
   docWidth = document.body.clientWidth;
   docHeight = document.body.clientHeight;
   document.getElementById("loft_win").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
   document.getElementById("loft_win").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth;
   document.getElementById("loft_win").style.visibility="visible";
   objTimer = window.setInterval("moveDiv()",10);
  }
  catch(e){}
}

//初始化位置
function resizeDiv()
{
  i+=1;
  //if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
  try
  {
   divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
   divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
   docWidth = document.body.clientWidth;
   docHeight = document.body.clientHeight;
   document.getElementById("loft_win").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10);
   document.getElementById("loft_win").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10);
  }
  catch(e){}
}

//最小化
function minsizeDiv()
{
  i+=1
  //if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
  try
  {
   divHeight = parseInt(document.getElementById("loft_win_min").offsetHeight,10);
   divWidth = parseInt(document.getElementById("loft_win_min").offsetWidth,10);
   docWidth = document.body.clientWidth;
   docHeight = document.body.clientHeight;
   document.getElementById("loft_win_min").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10);
   document.getElementById("loft_win_min").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10);
  }
  catch(e){}
}

//移动
function moveDiv()
{
try
{
  if(parseInt(document.getElementById("loft_win").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
  {
   window.clearInterval(objTimer);
   objTimer = window.setInterval("resizeDiv()",1);
  }
  divTop = parseInt(document.getElementById("loft_win").style.top,10);
  document.getElementById("loft_win").style.top = divTop -1;
}
  catch(e){}
}

function minDiv()
{
  closeDiv();
  document.getElementById('loft_win_min').style.visibility='visible';
  objTimer = window.setInterval("minsizeDiv()",1);
}

function maxDiv()
{
  document.getElementById('loft_win_min').style.visibility='hidden';
  document.getElementById('loft_win').style.visibility='visible';
  objTimer = window.setInterval("resiz