熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

頁面右下角彈出提示框示例代碼js版

2013-11-15 12:16:14  來源: JSP教程 
右下角彈出提示框想必大家不會陌生吧本文簡單的為大家實現一個具體代碼如下有需求的朋友可以參考下   復制代碼 代碼如下:

  
<%@ page language="java" import="javautil*" pageEncoding="UTF"%>
<%
String path = requestgetContextPath();
String basePath = requestgetScheme()+"://"+requestgetServerName()+":"+requestgetServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "//WC//DTD XHTML Transitional//EN" "
<html xmlns="
<head>
<meta httpequiv="ContentType" content="text/html; charset=gb" />
<title>無標題文檔</title>
<style type="text/css">
* {margin:px;padding:px;}
htmlbody { height:%;}
body { fontsize:px; lineheight:px;}
#tip {
position: absolute;
right: px;
bottom: px;
height: px;
width: px;
border: px solid #CCCCCC;
backgroundcolor: #eeeeee;
padding: px;
overflow:hidden;
display:none;
fontsize:px;
zindex:;
}
#tip p { padding:px;}
#tip h#detail h {
fontsize:px;
height:px;
lineheight:px;
backgroundcolor:#CC;
color:#FFFFFF;
padding:px px px px;
filter: Alpha(Opacity=);
}
#tip h a#detail h a {
float:right;
textdecoration:none;
color:#FFFFFF;
}
#shadow {
position:absolute;
width:%;
height:%;
backgroundcolor:#;
zindex:;
filter: Alpha(Opacity=);
display:none;
overflow:hidden;
}
#detail {
width:px;
height:px;
border:px double #ccc;
backgroundcolor:#FFFFFF;
position:absolute;
zindex:;
display:none;
left:%;
top:%
}
</style>
<script type="text/javascript">
var handle;
function start()
{
var obj = documentgetElementById("tip");
if (parseInt(objstyleheight)==)
{ objstyledisplay="block";
handle = setInterval("changeH(up)");
}else
{
handle = setInterval("changeH(down)")
}
}
function changeH(str)
{
var obj = documentgetElementById("tip");
if(str=="up")
{
if (parseInt(objstyleheight)>)
clearInterval(handle);
else
objstyleheight=(parseInt(objstyleheight)+)toString()+"px";
}
if(str=="down")
{
if (parseInt(objstyleheight)<)
{ clearInterval(handle);
objstyledisplay="none";
}
else
objstyleheight=(parseInt(objstyleheight))toString()+"px";
}
}
function showwin()
{
documentgetElementsByTagName("html")[]styleoverflow = "hidden";
start();
documentgetElementById("shadow")styledisplay="block";
documentgetElementById("detail")styledisplay="block";
}
function recover()
{
documentgetElementsByTagName("html")[]styleoverflow = "auto";
documentgetElementById("shadow")styledisplay="none";
documentgetElementById("detail")styledisplay="none";
}
</script>
</head>
<body onload="documentgetElementById(tip)styleheight=px">
<div id="shadow"> </div>
<div id="detail">
</div>
<div id="tip"><h><a href="javascript:void()" onclick="start()">×</a>您有新消息</h><p><a href="javascript:void()" onclick="showwin()">點擊這裡查看詳細</a></p></div>

</body>
</html>
<script language="JavaScript">
windowattachEvent("onload" myTimer); //綁定到onload事件
function myTimer() {
start();
windowsetTimeout("myTimer()");//設置循環時間
}
</script>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20612.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.