<Script language="javascript"> <!-- window.onload = getMsg; window.onresize = resizeDiv; window.onerror = function(){} //短信提示使用(asilas添加) var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0; function getMsg() { try{ // parseInt(String s, int radix) // 使用第二个参数指定的基数,将字符串参数解析为有符号的整数。 Integer中的方法 divTop = parseInt(document.getElementById("eMeng").style.top,10) divLeft = parseInt(document.getElementById("eMeng").style.left,10) 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 = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth document.getElementById("eMeng").style.visibility="visible" objTimer = window.setInterval("moveDiv()",10) } catch(e){} } function resizeDiv() { i+=1 if(i>99999) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句 try{ 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 - divHeight + parseInt(document.body.scrollTop,10) document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10) } catch(e){} } function moveDiv() { try { if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))) { window.clearInterval(objTimer) objTimer = window.setInterval("resizeDiv()",1) } divTop = parseInt(document.getElementById("eMeng").style.top,10) document.getElementById("eMeng").style.top = divTop - 1 } catch(e){} } function closeDiv() { document.getElementById('eMeng').style.visibility='hidden'; if(objTimer) window.clearInterval(objTimer) } --> </Script>
完整jsp页面代码:
<%@ page language="java" import="java.util.*" pageEncoding="utf8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'addwin.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<Script language="javascript">
<!--
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try{
// parseInt(String s, int radix)
// 使用第二个参数指定的基数,将字符串参数解析为有符号的整数。 Integer中的方法
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
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 = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("eMeng").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}
function resizeDiv()
{
i+=1
if(i>99999) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
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 - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}
function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
-->
</Script>
<DIV id=eMeng
style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 2px;
VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 160px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute;
TOP: 1px; HEIGHT: 25px; BACKGROUND-COLOR: #c9d3f3">
<TABLE width="160" height="25" border=0 cellPadding=0 cellSpacing=0 bgColor=#AFDCF3
style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" >
<TBODY>
<TR bgColor=#6699cc>
<TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c; top=100, left=100" width=6 height=24 >说的</TD>
<TD width="267" height="20" vAlign=center
style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif');
color: #ffffff; padding-left: 4px; padding-top: 4px " ><a href="http://609598174.qzone.qq.com" target="_blank">
-----我的空间------
padding-left: 4px;弹出窗口文字句窗口左边的距离
padding-top: 4px弹出窗口文字句窗口左边的距离
</a></TD>
<TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=26 top=100, left=100>
<span title=关闭
style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" top=100, left=100
οnclick=closeDiv() ><font color="#000000">×</font></span>
<!--<IMG title=关闭 style="CURSOR: hand" οnclick=closeDiv() hspace=3 src="msgClose.jpg">-->
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
有勇气来改变可以改变的事情,有胸怀来接受不可改变的事情,有智慧来分辨两者的不同!
知道事物应该是什么样,说明你是聪明的人;知道事物实际是什么样,说明你是有经验的人;
知道怎样使事物变得更好,说明你是有才能的人。
记得感激每一个帮助你的人啊 <SCRIPT LANGUAGE="JavaScript"> var s = "";
参数说明:
s += "\r\n网页可见区域宽:"+ document.body.clientWidth;
s += "\r\n网页可见区域高:"+ document.body.clientHeight;
s += "\r\n网页可见区域宽:"+ document.body.offsetWidth +" (包括边线和滚动条的宽)";
s += "\r\n网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
s += "\r\n网页正文全文宽:"+ document.body.scrollWidth;
s += "\r\n网页正文全文高:"+ document.body.scrollHeight;
s += "\r\n网页被卷去的高:"+ document.body.scrollTop;
s += "\r\n网页被卷去的左:"+ document.body.scrollLeft;
s += "\r\n网页正文部分上:"+ window.screenTop;
s += "\r\n网页正文部分左:"+ window.screenLeft;
s += "\r\n屏幕分辨率的高:"+ window.screen.height;
s += "\r\n屏幕分辨率的宽:"+ window.screen.width;
s += "\r\n屏幕可用工作区高度:"+ window.screen.availHeight;
s += "\r\n屏幕可用工作区宽度:"+ window.screen.availWidth;
s += "\r\n你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色";
s += "\r\n你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸";
alert(s);
</SCRIPT>
</head>
<body>
This is my JSP page. <br>
</body>
</html>